ContextualVersionConflict, when attempting to pip install google-cloud-bigquery on AWS SageMaker - python

pip install google-cloud-bigquery
Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 in /home/ec2-user/anaconda3/envs/python3/lib/python3.8/site-packages (from pyasn1-modules>=0.2.1->google-auth<3.0dev,>=1.25.0->google-api-core[grpc]!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0,<3.0.0dev,>=1.31.5->google-cloud-bigquery) (0.4.8)
Installing collected packages: pyasn1-modules, protobuf, grpcio, google-crc32c, cachetools, proto-plus, googleapis-common-protos, google-resumable-media, google-auth, grpcio-status, google-api-core, google-cloud-core, google-cloud-bigquery-storage, google-cloud-bigquery
Attempting uninstall: protobuf
Found existing installation: protobuf 3.19.1
Uninstalling protobuf-3.19.1:
Successfully uninstalled protobuf-3.19.1
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
sagemaker 2.117.0 requires protobuf<4.0,>=3.1, but you have protobuf 4.21.9 which is incompatible.
Successfully installed cachetools-5.2.0 google-api-core-2.10.2 google-auth-2.14.1 google-cloud-bigquery-3.4.0 google-cloud-bigquery-storage-2.16.2 google-cloud-core-2.3.2 google-crc32c-1.5.0 google-resumable-media-2.4.0 googleapis-common-protos-1.57.0 grpcio-1.51.0 grpcio-status-1.51.0 proto-plus-1.22.1 protobuf-4.21.9 pyasn1-modules-0.2.8
WARNING: You are using pip version 22.0.4; however, version 22.3.1 is available.
You should consider upgrading via the '/home/ec2-user/anaconda3/envs/python3/bin/python -m pip install --upgrade pip' command.
Note: you may need to restart the kernel to use updated packages.
ContextualVersionConflict: (protobuf 3.19.1 (/home/ec2-user/anaconda3/envs/python3/lib/python3.8/site-packages), Requirement.parse('protobuf!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.19.5'), {'google-cloud-bigquery-storage'})

Try running pip install -U protobuf~=3.20.0 and then pip install google-cloud-bigquery.
Protobuf 4.x versions have some incompatibilities with other libraries.
Ref: How to downgrade protobuf

Related

Why does this happens when downgrading the library

Why does this happens when downgrading the library
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
pyppeteer 0.2.5 requires importlib-metadata<3.0.0,>=2.1.1; python_version < "3.8", but you have importlib-metadata 4.12.0 which is incompatible.
pyppeteer 0.2.5 requires urllib3<2.0.0,>=1.25.8, but you have urllib3 1.24.3 which is incompatible.
Successfully installed appdirs-1.4.4 attrs-22.1.0 black-22.1.0 click-8.1.3 importlib-metadata-4.12.0 pathspec-0.10.1 regex-2022.8.17 toml-0.10.2 typed-ast-1.5.4 typing-extensions-4.3.0 zipp-3.8.1
WARNING: You are using pip version 22.0.4; however, version 22.2.2 is available.
You should consider upgrading via the '/Users/admin/.local/share/virtualenvs/scrapers-XJakbnzz/bin/python -m pip install --upgrade pip' command.
This is a conflict of package versions. To fix it, you'll need to follow these steps:
1)pip list
2)copy all of your packages
3)create a new file called requirements.txt
4)put all of your packages in there (without versions). The file should look like this:
autopep8
certifi
chardet
charset-normalizer
click
colorama
discord
Flask
itsdangerous
pip
praw
(except this has to be a list of your packages that you got while running pip list)
5)pip install -r requirements.txt
This will tell pip to solve the version conflict.

ERROR: Cannot uninstall 'PyGObject'. It is a distutils installed project

I am updating PyGObject and give an error.
How should I update PyGObject
.....
Environment:
macOS Big Sur 11.5.2
python --version
Python 3.9.7
pip --version
pip 21.2.4 from /usr/local/lib/python3.9/site-packages/pip (python 3.9)
my operation.
ERROR: Cannot uninstall 'PyGObject'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
pip install --upgrade PyGObject
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
Requirement already satisfied: PyGObject in /usr/local/lib/python3.9/site-packages (3.40.1)
Collecting PyGObject
Using cached PyGObject-3.42.0-cp39-cp39-macosx_11_0_x86_64.whl
Requirement already satisfied: pycairo>=1.16.0 in /usr/local/lib/python3.9/site-packages (from PyGObject) (1.20.1)
Installing collected packages: PyGObject
Attempting uninstall: PyGObject
Found existing installation: PyGObject 3.40.1
ERROR: Cannot uninstall 'PyGObject'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
Pip is unsure on the package dependencies to clean up in the upgrade. You can force the upgrade by telling it to ignore what is already installed.
pip install PyGObject --ignore-installed

Having trouble installing PyTorch

I'm having trouble installing PyTorch.
C:\Users\myself>pip install torch
Collecting torch
Using cached torch-1.7.1-cp38-cp38-win_amd64.whl (184.0 MB)
Requirement already satisfied: numpy in c:\users\myself\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from torch) (1.19.1)
Requirement already satisfied: typing-extensions in c:\users\myself\appdata\local\packages\pythonsoftwarefoundation.python.3.8_qbz5n2kfra8p0\localcache\local-packages\python38\site-packages (from torch) (3.7.4.3)
Installing collected packages: torch
ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: 'C:\\Users\\myself\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python38\\site-packages\\caffe2\\python\\serialized_test\\data\\operator_test\\learning_rate_adaption_op_test.test_learning_rate_adaption_op_normalization.zip'
WARNING: You are using pip version 20.2.4; however, version 20.3.3 is available.
You should consider upgrading via the 'C:\Users\myself\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe -m pip install --upgrade pip' command.
It says that I'm missing a file in caffe2, but I'm not sure how I can get that file back.
Torch wheel contains caffe2 directory.
1.Try --no-cache-dir option
pip install --no-cache-dir torch
2. Removing the MAX_PATH Limitation
See here 3. Using Python on Windows — Python 3.7.9 documentation. You can find some more detailed discussion here.

Django failed to build wheel for python-ldap

I'm new to Python Django, I have integrated my Django application on Windows 7 machine. When I tried to integrate LDAP by using pip install django-auth-ldap but unfortunately I got an error
Failed building wheel for python-ldap
Running setup.py clean for python-ldap
Failed to build python-ldap
django-python3-ldap 0.11.1 has requirement pyasn1==0.3.2, but you'll have pyasn1 0.4.4 which is incompatible.
Please help me to escape me from this issue, bcz I have been struck here for a couple of days
I think this message is pretty clear:
django-python3-ldap 0.11.1 has requirement pyasn1==0.3.2, but you'll have pyasn1 0.4.4 which is incompatible.
When using django-python3-ldap you have to explicitly use version 0.3.2 of module pyasn1. But something else already installed a newer version of pyasn1 to you build environment.
So you have to specify version pinning information in install_requires or requirements files.
Try Updating pip using
python -m pip install -U pip
or
pip install --upgrade pip

Downgrading Python Setuptools

I am getting an error while attempting to use Pyinstaller. After doing some research I believe the error is caused by a bug in the most recent version of setuptools (19.3). The fix seems to be downgrading to setuptools version 19.2. My issue is with the downgrade itself. My question is how does one downgrade setuptools in Ubuntu 15.04?
Just specify the version using pip:
pip install setuptools==19.2
If you are installing globally you will obviously need sudo.
~$ sudo pip install setuptools==19.2
Collecting setuptools==19.2
Downloading setuptools-19.2-py2.py3-none-any.whl (463kB)
100% |████████████████████████████████| 466kB 486kB/s
Installing collected packages: setuptools
Found existing installation: setuptools 19.1
Uninstalling setuptools-19.1:
Successfully uninstalled setuptools-19.1
Successfully installed setuptools-19.2
~$ sudo pip install setuptools==19.1
Collecting setuptools==19.1
Downloading setuptools-19.1-py2.py3-none-any.whl (463kB)
100% |████████████████████████████████| 466kB 377kB/s
Installing collected packages: setuptools
Found existing installation: setuptools 19.2
Uninstalling setuptools-19.2:
Successfully uninstalled setuptools-19.2
Successfully installed setuptools-19.1

Categories