"Project was not passed" error, even though ran
See original GitHub issueI attempted to follow the setup instructions and ran into an odd error. The instructions I was following are here: https://googlecloudplatform.github.io/gcloud-python/stable/gcloud-auth.html
Here is what I attempted:
virtualenv ~/venvsource ~/venv/bin/activatepip install gcloudgcloud auth loginpython
>>> from gcloud import pubsub
>>> pubsub.Client()
Here’s the error I received when I ran pubsub.Client()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".../venv/local/lib/python2.7/site-packages/gcloud/client.py", line 184, in __init__
    _ClientProjectMixin.__init__(self, project=project)
  File ".../venv/local/lib/python2.7/site-packages/gcloud/client.py", line 143, in __init__
    raise EnvironmentError('Project was not passed and could not be '
EnvironmentError: Project was not passed and could not be determined from the environment.
I do appear to have valid credentials. gcloud.credentials.get_credentials() happily provides me with a perfectly good GoogleCredentials object which works fine with httplib2 if I invoke it directly.
Issue Analytics
- State:
 - Created 7 years ago
 - Comments:6 (6 by maintainers)
 
Top Results From Across the Web
gcloud - Google Vision API - Project not passed - Stack Overflow
I created a test project then stored my credentials locally. However, when running the application I first authenticated via "gcloud auth ...
Read more >One or More Projects in the solution were not loaded correctly
If you want to fix this types of error then must to update your tools, I face this problem when I was not...
Read more >Troubleshooting CI/CD - GitLab Docs
If a pipeline did not run, it's likely that all the jobs had rules or only/except that blocked them from being added to...
Read more >Fix program errors and improve code - Visual Studio (Windows)
Rebuild your project by either pressing F7 again (to recompile only the files with errors) or Ctrl+Alt+F7 (for a clean and complete rebuild)....
Read more >Explore test results | IntelliJ IDEA Documentation - JetBrains
Test error. This status is assigned to tests that caused an exception from the tested source code. Test failed. If at least one...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thanks for the report! In addition to credentials, we need to know what project to use: a given set of credentials can have access to multiple projects. On GCE / GAE, we can determine the project from the host setup. On your own machine, you need to set an environment variable. E.g.:
Or you can pass the project to the
Clientconstructor:I think the “usage doc” sections should all link to a shared page explaining this requirement (similar to the Authentication page). @dhermes, @jgeewax WDYT?
Not really.
oauth2clientis only concerned with auth.