Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23247

Python and pip misconfiguration leads to package installation errors

$
0
0

I'm facing an issue with Python and pip where packages are not being installed under the correct version of Python. I am using Python 3.9.6:

python3 -VPython 3.9.6

The pip version

pip3 --versionpip 21.2.4 from /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages/pip (python 3.9)

The paths for pip3 and python3 are:

whereis pip3pip3: /usr/bin/pip3whereis python3python3: /usr/bin/python3

Despite this, when I try to install google-cloud-storage using pip3 install google-cloud-storage, the package seems to install under Python 3.8. I receive the following warning:

WARNING: Target directory /usr/local/lib/python3.8/site-packages/googleapis_common_protos-1.63.0.dist-info already exists. Specify --upgrade to force replacement.

I attempted to resolve this by creating a virtual environment with:

/Library/Developer/CommandLineTools/usr/bin/python3 -m venv venvAnd installing the package within the virtual environment:

/Users/username/Desktop/project/venv/bin/python3 -m pip install --upgrade google-cloud-storage

However, this did not resolve the issue. When I run my script, I get the following error:

Traceback (most recent call last):  File "/Users/username/Desktop/project/main.py", line 3, in <module>    from google.cloud import storageModuleNotFoundError: No module named 'google'

Additionally, google-cloud-storage does not appear in the output of pip list or pip3 list.

I installed Python 3.9 using Homebrew. I have deleted all Python versions from /usr/local/lib/. I don't have any other version of Python other than Python 3.9 currently installed.Could there be an issue with how pip is linked to Python versions on my system? How can I ensure that pip3 installs packages under Python 3.9?

Any help would be appreciated!


Viewing all articles
Browse latest Browse all 23247

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>