I have it many times that when installing with pip I get success messages followed by red lines with warnings. An example:
Successfully built qgrid
spacy 2.0.11 has requirement regex==2017.4.5, but you'll have regex 2017.11.9 which is incompatible.
proto-google-cloud-vision-v1 0.90.3 has requirement oauth2client<4.0dev,>=2.0.0, but you'll have oauth2client 4.1.2 which is incompatible.
proto-google-cloud-speech-v1beta1 0.15.3 has requirement oauth2client<4.0dev,>=2.0.0, but you'll have oauth2client 4.1.2 which is incompatible.
proto-google-cloud-spanner-v1 0.15.3 has requirement oauth2client<4.0dev,>=2.0.0, but you'll have oauth2client 4.1.2 which is incompatible.
How do I reconcile the state of the install in such cases? do these messages simply imply that older versions will be used so that the compatibility of previously installed packages will preserve? does it also imply that the newly installed package has requested newer versions and may or may not work well, with the old ones present?
How do you usually proceed in these cases?
Obviously working with virtual environments may remove the clashes, but I can see this happening also in virtual environments.
Thanks!
In these case, try :
py -m name_of_your_initial_package install --upgrade name_of_your_initial_package.
name_of_your_initial_package* example: proto-google-cloud-vision-v1
Full example :
py -m proto-google-cloud-vision-v1 install --upgrade proto-google-cloud-vision-v1
To do that you need to install your package with pip before :
py -m pip install proto-google-cloud-vision-v1
Related
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.
I installed Jupyter notebook and labs on and EC2 instance and for some reason I get the following error:
ImportError: cannot import name 'filefind' from 'traitlets.utils' (/usr/lib/python3/dist-packages/traitlets/utils/init.py)
Jupyter opens fine in the browser but I can't seem to be able to work in an python notebook.
I disencourage the solution of op. Downloading and overwriting python libraries is not the way of keeping your system stable and clean!
What I found out is that while installing Jupyter notebook it had found four significant errors which resulted from python3 packages that were not installed correctly within that installation itself.
ERROR: ipykernel 6.6.0 has requirement traitlets<6.0,>=5.1.0, but you'll have traitlets 4.3.3 which is incompatible. ERROR: jupyterlab-pygments 0.1.2 has requirement pygments<3,>=2.4.1, but you'll have pygments 2.3.1 which is incompatible. ERROR: nbconvert 6.3.0 has requirement pygments>=2.4.1, but you'll have pygments 2.3.1 which is incompatible. ERROR: nbconvert 6.3.0 has requirement traitlets>=5.0, but you'll have traitlets 4.3.3 which is incompatible.
The solution is to just patch the packages to the newest version with:
pip3 install traitlets==5.1.1
pip3 install pygments==2.4.1
This applies to all similar cases where outdated packages prevent you from your installation
Dirty initial fix (not recommended):
Oke fixed it!
It seems like the problem was that the "traitlets/utils/init.py" was empty.
So I copy-pasted the code from GitHub and that worked.
https://github.com/ipython/traitlets/blob/main/traitlets/utils/__init__.py
I got this problem twice when I installed two different ec2 instances installing cuda and cudnn. So it might that this has something to do with the origins of this issue.
Proper fix:
The proper way to fix this problem is by upgrading/downgrading the library. Check the other answers to this post for guidance.
I faced the same issue. Downgrading the versions of traitlets and pygments alone, as suggested by #luarzou, didn't solved the problem for me.
I also downgrade ipykernel and it works now:
pip install ipykernel==6.0
I opened an issue:
https://github.com/ipython/ipykernel/issues/857
Edit: actually this error can happen when your venv has versions of ipykernel or its dependencies different than the env running jupyter. I suggest in that case to delete and recreate your venv, and verify that you don't install there packages that will break the communication/compatibility.
I had the same issue on all env other than the base. Even installed the same version of traitlets, pygments and ipykernel as in base,it also failed. After a couple of searches, I removed traitlets using
sudo apt-get remove python3-traitlets
sudo apt-get remove --auto-remove python3-traitlets
Then I installed jupyter
conda install notebook ipykernel jupyterlab
This solved my issue on all environments
Is there a way to tell the package manager pip to never replace newer by older versions when installing packages from a requirements.txt?
Example:
I have Robot Framework 3.2.2 and Waitress 1.4.3 installed and my requirements.txt looks like this:
...
robotframework==3.0.2
waitress==1.4.4
...
Hence, I would only want the waitress requirement to be refreshed.
The reason is that I need to automate the installation of dependencies via requirement files and can't just change their content.
You could use >= to tell pip to install newer versions, or that version.
For example:
robotframework>=3.0.2
waitress>=1.4.4
Would tell pip to install any version that is at least 3.0.2 for robotframework, and at least 1.4.4 for waitress.
I am trying to install the OpenCV-python on my mac and i have used the following:
$pip install opencv-python
which gave me the following error:
$pip install opencv-python
Collecting opencv-python
Using cached opencv_python-3.4.0.12-cp27-cp27m macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
Collecting numpy>=1.11.1 (from opencv-python)
Using cached numpy-1.14.2-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl
matplotlib 1.3.1 requires nose, which is not installed.
matplotlib 1.3.1 requires tornado, which is not installed.
Installing collected packages: numpy, opencv-python
Found existing installation: numpy 1.8.0rc1
Cannot uninstall 'numpy'. 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.
Then i did try the pip install --upgrade matplotlib which didnot change anything. It just show me:
matplotlib 2.2.2 requires backports.functools-lru-cache, which is not installed.
matplotlib 2.2.2 has requirement numpy>=1.7.1, but you'll have numpy 1.8.0rc1 which is incompatible.
As I found many ways to install the openCV-python in the internet like:
https://www.pyimagesearch.com/2015/06/15/install-opencv-3-0-and-python-2-7-on-osx/
and I installed on my other mac but i got import cv2 problem alot in my codes.
I will be more than happy if anyone have a good solution or recommendation to install the openCV-python.
Thanks
In summary, macOS comes with the Python preinstalled and you should not mess with the packages installed as some system utilities depend on them.
https://docs.python.org/3.7/using/mac.html
The Apple-provided build of Python is installed in /System/Library/Frameworks/Python.framework and /usr/bin/python, respectively. You should never modify or delete these, as they are Apple-controlled and are used by Apple- or third-party software. Remember that if you choose to install a newer Python version from python.org, you will have two different but functional Python installations on your computer, so it will be important that your paths and usages are consistent with what you want to do.
You should take a look on either venv or virtualenv.
You can read this answer: https://stackoverflow.com/a/41972262/4796844 that will get you through the basics.
In a nutshell, to solve your problem:
$ python3 -m venv ./project-name
$ . ./project-name/bin/activate
$ pip install opencv-python
And to leave the virtual environment, simply:
$ deactivate
I have installed Caffe on my Ubuntu15.10x64 Machine with protobuf 2.6.1. Also, as of today, I installed TensorFlow with virtualenv but TensorFlow needs protobuf 3.0. From what I have read, virtualenv supports using different libraries for python projects. Can I safely pip install --upgrade protobuf inside the (tensorflow) virtualenv without disrupting my Caffe install - thus having protobuf 2.6 as default, and protobuf 3.0 in my virtualenv used by TensorFlow?
Or is the only solution to install with Docker or Create a Clone in a Virtual Machine? Better than nothing, but I would like to use my GPU and full power.
Thanks for help and clarification.
Edit:
So, this is what happens when I try to update protobuf ->
(tensorflow)peter#UNIGMA:~$ pip install --upgrade protobuf
Requirement already up-to-date: protobuf in /usr/local/lib/python2.7/dist-packages
Requirement already up-to-date: setuptools in ./tensorflow/lib/python2.7/site-packages (from protobuf)
Cleaning up...
If i check the version this is what it returns ->
(tensorflow)peter#UNIGMA:~$ pip show protobuf
---
Name: protobuf
Version: 2.6.1
Location: /usr/local/lib/python2.7/dist-packages
Requires: setuptools
(tensorflow)peter#UNIGMA:~$ pip -V
pip 1.5.6 from /home/peter/tensorflow/local/lib/python2.7/site-packages (python 2.7)
Do I have to manually update protobuf? I presume that I would create a protobuf folder inside ./tensorflow/lib/python2.7/dist-packages with the version I need?
Note that your virtualenv doesn't see packages from outside, so you should not have protobuf visible in your virtualenv at all, even though you have it installed globally in the system (or in the Caffe's virtualenv, depending on your setup).
It should be safe for you to run pip install protobuf inside the TensorFlow's virtualenv, it will not disrupt your global setup or any other virtualenv you have.