how do i revert an pip upgrade - python

I did the following command just now,
pip install --upgrade ipykernel
However, i got
Requirement already satisfied: ipykernel in ./anaconda3/lib/python3.8/site-packages (5.3.4)
Collecting ipykernel
Downloading ipykernel-6.5.0-py3-none-any.whl (125 kB)
|████████████████████████████████| 125 kB 4.3 MB/s
Collecting ipython<8.0,>=7.23.1
Downloading ipython-7.29.0-py3-none-any.whl (790 kB)
|████████████████████████████████| 790 kB 9.2 MB/s
Collecting debugpy<2.0,>=1.0.0
Downloading debugpy-1.5.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl (1.9 MB)
|████████████████████████████████| 1.9 MB 126.8 MB/s
Collecting matplotlib-inline<0.2.0,>=0.1.0
Downloading matplotlib_inline-0.1.3-py3-none-any.whl (8.2 kB)
Collecting traitlets<6.0,>=5.1.0
Downloading traitlets-5.1.1-py3-none-any.whl (102 kB)
|████████████████████████████████| 102 kB 20.5 MB/s
...
Requirement already satisfied: python-dateutil>=2.1 in ./anaconda3/lib/python3.8/site-packages (from jupyter-client<8.0->ipykernel) (2.8.1)
Requirement already satisfied: ptyprocess>=0.5 in ./anaconda3/lib/python3.8/site-packages (from pexpect>4.3->ipython<8.0,>=7.23.1->ipykernel) (0.7.0)
Requirement already satisfied: wcwidth in ./anaconda3/lib/python3.8/site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython<8.0,>=7.23.1->ipykernel) (0.2.5)
Requirement already satisfied: six>=1.5 in ./anaconda3/lib/python3.8/site-packages (from python-dateutil>=2.1->jupyter-client<8.0->ipykernel) (1.15.0)
Installing collected packages: traitlets, matplotlib-inline, ipython, debugpy, ipykernel
Attempting uninstall: traitlets
Found existing installation: traitlets 5.0.5
Uninstalling traitlets-5.0.5:
Successfully uninstalled traitlets-5.0.5
Attempting uninstall: ipython
Found existing installation: ipython 7.22.0
Uninstalling ipython-7.22.0:
Successfully uninstalled ipython-7.22.0
Attempting uninstall: ipykernel
Found existing installation: ipykernel 5.3.4
Uninstalling ipykernel-5.3.4:
Successfully uninstalled ipykernel-5.3.4
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.
spyder 4.2.5 requires pyqt5<5.13, which is not installed.
spyder 4.2.5 requires pyqtwebengine<5.13, which is not installed.
conda-repo-cli 1.0.4 requires pathlib, which is not installed.
Successfully installed debugpy-1.5.1 ipykernel-6.5.0 ipython-7.29.0 matplotlib-inline-0.1.3 traitlets-5.1.1
I would like to revert my command, since some of my codes suddenly does not work
. Is it possible? Thanks!
It seems a lot fo packages are installed.
Update
So I actually had my environment.yaml from my previous conda env export > environment.yaml
If I do
conda env update --file environment.yaml --prune
It does not help me revert to my previous versions.... Can I force my base environment back to exactly environment.yaml?

I do not believe pip keeps a history of installed packages. If you have the text output from the terminal when you did the upgrade, pip does output a list of packages that will be installed, which version you had and which version you're replacing it with. You can manually revert each package by doing
pip uninstall <package_name> && pip install <package_name>==<version_number>
Edit: Based on your edits, I suggest you repost this question in terms of your conda environment. That's a totally different system, even though it does utilize pip.
As a side note, you might be able to get away with just running
pip install traitlets==5.0.5
pip install ipykernel==5.3.4
pip install ipython==7.22.0

Related

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.

Why can I install pytorch with pip but not with pipenv

I am a relative pipenv newbie, and I am trying to install pytorch with cuda 11 for a machine learning project.
I am installing pytorch on linux with python 3.6. I have made a fresh pipenv environment with pipenv install.
To install the latest version of pytorch with cuda 11, the command is:
pip install torch==1.7.0+cu110 torchvision==0.8.1+cu110 torchaudio===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html
When I run this command, it works fine and installs:
$ pip install torch==1.7.0+cu110 torchvision==0.8.1+cu110 torchaudio===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html
Looking in links: https://download.pytorch.org/whl/torch_stable.html
Collecting torch==1.7.0+cu110
Using cached https://download.pytorch.org/whl/cu110/torch-1.7.0%2Bcu110-cp36-cp36m-linux_x86_64.whl (1137.1 MB)
Collecting torchvision==0.8.1+cu110
Using cached https://download.pytorch.org/whl/cu110/torchvision-0.8.1%2Bcu110-cp36-cp36m-linux_x86_64.whl (12.9 MB)
Collecting torchaudio===0.7.0
Using cached torchaudio-0.7.0-cp36-cp36m-manylinux1_x86_64.whl (7.6 MB)
Collecting dataclasses
Using cached dataclasses-0.8-py3-none-any.whl (19 kB)
Collecting numpy
Using cached numpy-1.19.4-cp36-cp36m-manylinux2010_x86_64.whl (14.5 MB)
Processing /home/denisonc/.cache/pip/wheels/6e/9c/ed/4499c9865ac1002697793e0ae05ba6be33553d098f3347fb94/future-0.18.2-py3-none-any.whl
Collecting typing-extensions
Using cached typing_extensions-3.7.4.3-py3-none-any.whl (22 kB)
Collecting pillow>=4.1.1
Using cached Pillow-8.0.1-cp36-cp36m-manylinux1_x86_64.whl (2.2 MB)
Installing collected packages: dataclasses, numpy, future, typing-extensions, torch, pillow, torchvision, torchaudio
Successfully installed dataclasses-0.8 future-0.18.2 numpy-1.19.4 pillow-8.0.1 torch-1.7.0+cu110 torchaudio-0.7.0 torchvision-0.8.1+cu110 typing-extensions-3.7.4.3
(deep-sinter) [denisonc#cvgpu02 deep-sinter]$ pipenv update
Running $ pipenv lock then $ pipenv sync.
Locking [dev-packages] dependencies...
Locking [packages] dependencies...
Updated Pipfile.lock (ca72e7)!
Installing dependencies from Pipfile.lock (ca72e7)...
🐍 ▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉▉ 0/0 — 00:00:00
All dependencies are now up-to-date!
However, changing 'pip' to 'pipenv' causes the following error:
$ pipenv install torch==1.7.0+cu110 torchvision==0.8.1+cu110 torchaudio===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html
Installing torch==1.7.0+cu110...
Error: An error occurred while installing torch==1.7.0+cu110!
Error text:
ERROR: Could not find a version that satisfies the requirement torch==1.7.0+cu110 (from -r /tmp/pipenv-tvts06b7-requirements/pipenv-0wd75ill-requirement.txt (line 1)) (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2, 0.3.1, 0.4.0, 0.4.1, 1.0.0, 1.0.1, 1.0.1.post2, 1.1.0, 1.2.0, 1.3.0, 1.3.1, 1.4.0, 1.5.0, 1.5.1, 1.6.0, 1.7.0)
ERROR: No matching distribution found for torch==1.7.0+cu110 (from -r /tmp/pipenv-tvts06b7-requirements/pipenv-0wd75ill-requirement.txt (line 1))
✘ Installation Failed
Last week I was able to complete this installation on the same system in a different pipenv. In the mean time I upgraded pipenv to the latest version. This error occurred after the upgade.
This is very confusing to me because my understanding was that pipenv uses pip under the hood. I can't understand why the behavior would be different. I would like to install pytorch within my pip environment so that I can keep libraries isolated from other projects.

unable to install pdflatex using spyder

pip install attrs==19.2.0 --user Collecting attrs==19.2.0 Using cached attrs-19.2.0-py2.py3-none-any.whl (40 kB) Installing collected
packages: attrs Attempting uninstall: attrs
Found existing installation: attrs 19.1.0
Uninstalling attrs-19.1.0:
Successfully uninstalled attrs-19.1.0 Successfully installed attrs-19.2.0 Note: you may need to restart the kernel to use updated
packages. ERROR: pdflatex 0.1.3 has requirement attrs<19.0,>=18.2, but
you'll have attrs 19.2.0 which is incompatible.
pip install pdflatex --user Requirement already satisfied: pdflatex in
c:\users\haris\appdata\roaming\python\python37\site-packages (0.1.3)
Collecting attrs<19.0,>=18.2 Using cached
attrs-18.2.0-py2.py3-none-any.whl (34 kB) Installing collected
packages: attrs Attempting uninstall: attrs
Found existing installation: attrs 19.2.0
Uninstalling attrs-19.2.0:
Successfully uninstalled attrs-19.2.0 Successfully installed attrs-18.2.0 Note: you may need to restart the kernel to use updated
packages. ERROR: hypothesis 5.5.4 has requirement attrs>=19.2.0, but
you'll have attrs 18.2.0 which is incompatible.
need help to install pdflatex

pywin32 requirement is not satisfied after installing pypiwin32

Trying to install pyad package for Python 2.7.13 (windows x64) using pip.
There is pywin32 package among requirements, so we get an error:
C:\Windows\system32>pip install pyad
Collecting pyad
Using cached pyad-0.5.16.tar.gz
Requirement already satisfied: setuptools in c:\python27\lib\site-packages (from pyad)
Collecting pywin32 (from pyad)
Could not find a version that satisfies the requirement pywin32 (from pyad) (from versions: )
No matching distribution found for pywin32 (from pyad)
Then I install pypiwin32 which used to work in such cases:
C:\Windows\system32>pip install pypiwin32
Collecting pypiwin32
Using cached pypiwin32-219-cp27-none-win32.whl
Installing collected packages: pypiwin32
Successfully installed pypiwin32-219
But after this I still can't install pyad with the same error as above, like pypiwin32 has never been installed:
C:\Windows\system32>pip install pyad
Collecting pyad
Using cached pyad-0.5.16.tar.gz
Requirement already satisfied: setuptools in c:\python27\lib\site-packages (from pyad)
Collecting pywin32 (from pyad)
Could not find a version that satisfies the requirement pywin32 (from pyad) (from versions: )
No matching distribution found for pywin32 (from pyad)
Folder C:\Python27\Lib\site-packages\pywin32_system32 exists, the pypiwin32 package seems to be installed.
Any ideas to fix this?
You are facing pywin32 installation problem, which is a binary wheel.
You can download binary wheels of pywin32 here. You install it with
pip install pywin32-221-cp27-cp27m-win32.whl
if it is the file you have downloaded
Select the correct version with respect to your installation (Python version and 32/64 bit Python version)
You can have detailed instructions here
pyad is declaring it needs "the pywin32 distribution package" in order to be installed. Distribution packages, i.e. something from PyPI that you can pip install, differ from Python packages, folders with an __init__.py that can be imported. The naming is confusing.
So, because it's not installed, it tries to install pywin32, but it can't find a distribution that matches your Python environment: Python 2.7 on Windows x64. On PyPI it appears like the only distributions are for Python 3.6: https://pypi.python.org/pypi/pypiwin32/220

Error installing scrapy in python 3.5 [duplicate]

This question already has answers here:
python spyder conda install failure
(2 answers)
Why does "pip install" inside Python raise a SyntaxError?
(7 answers)
Closed 5 years ago.
I am installing Scrapy in Python 3.5. I am referring to the installation guide here .
I have installed pip and conda. I tried both ways mentioned in the guide, but am getting this error:
I have already installed pip and minoconda:
conda install -c scrapinghub scrapy
and
pip install Scrapy
What is wrong with the installation?
You're trying to install scrapy in the python interpreter, you should install the package in your terminal. What's more, one requirement of installing scrapy is python 2.7, you're using python 3.5
Update:
Good news: Python 3 is Coming to Scrapy, you can try pip install scrapy==1.1.0rc1 now. Note that there are still some limitations, but won't be long that scrapy will have full of 3.x support. Pay close attention to the scrapy development ;)
Scrapy doesn't work with Python 3. At the moment, scrapy works only with Python 2.7.
You can pip install scrapy on python 3.5+, you just have to pip install all the deppendencies first - from here https://docs.scrapy.org/en/latest/intro/install.html
pip install lxml
pip install parsel
pip install w3lib
pip install twisted
pip install cryptography
pip install cryptography
pip install pyOpenSSL
and finally
pip install scrapy - worked for me
Before installing Scrapy on Python 3.5 on Windows 10 in virtualenv
Install lxml,PyDispatcher then simpy install Scrapy code is attached.
(pymote_env) C:\Users\DDSHARMA\Documents\pymote_env>pip install PyDispatcher
Collecting PyDispatcher
Installing collected packages: PyDispatcher
Successfully installed PyDispatcher-2.0.5
(pymote_env) C:\Users\DDSHARMA\Documents\pymote_env>pip install Scrapy
Collecting Scrapy
Using cached Scrapy-1.2.1-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): six>=1.5.2 in c:\users\ddsharma\documents\pymote_env\lib\site-packages (from Scrapy)
Collecting service-identity (from Scrapy)
Using cached service_identity-16.0.0-py2.py3-none-any.whl
Collecting Twisted>=10.0.0 (from Scrapy)
Using cached Twisted-16.4.1.tar.bz2
Collecting parsel>=0.9.3 (from Scrapy)
Using cached parsel-1.0.3-py2.py3-none-any.whl
Collecting pyOpenSSL (from Scrapy)
Using cached pyOpenSSL-16.2.0-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): PyDispatcher>=2.0.5 in c:\users\ddsharma\documents\pymote_env\lib\site-packages (from Scrapy)
Requirement already satisfied (use --upgrade to upgrade): lxml in c:\users\ddsharma\documents\pymote_env\lib\site-packages (from Scrapy)
Collecting queuelib (from Scrapy)
Using cached queuelib-1.4.2-py2.py3-none-any.whl
Collecting w3lib>=1.15.0 (from Scrapy)
Using cached w3lib-1.15.0-py2.py3-none-any.whl
Collecting cssselect>=0.9 (from Scrapy)
Using cached cssselect-1.0.0-py2.py3-none-any.whl
Collecting pyasn1-modules (from service-identity->Scrapy)
Using cached pyasn1_modules-0.0.8-py2.py3-none-any.whl
Collecting pyasn1 (from service-identity->Scrapy)
Using cached pyasn1-0.1.9-py2.py3-none-any.whl
Collecting attrs (from service-identity->Scrapy)
Using cached attrs-16.2.0-py2.py3-none-any.whl
Collecting zope.interface>=4.0.2 (from Twisted>=10.0.0->Scrapy)
Using cached zope.interface-4.3.2-cp35-cp35m-win32.whl
Collecting cryptography>=1.3.4 (from pyOpenSSL->Scrapy)
Using cached cryptography-1.5.2-cp35-cp35m-win32.whl
Requirement already satisfied (use --upgrade to upgrade): setuptools in c:\users\ddsharma\documents\pymote_env\lib\site-packages (from zope.interface>=4.0.2->Twisted>=10.0.0->Scrapy)
Collecting idna>=2.0 (from cryptography>=1.3.4->pyOpenSSL->Scrapy)
Using cached idna-2.1-py2.py3-none-any.whl
Collecting cffi>=1.4.1 (from cryptography>=1.3.4->pyOpenSSL->Scrapy)
Using cached cffi-1.8.3-cp35-cp35m-win32.whl
Collecting pycparser (from cffi>=1.4.1->cryptography>=1.3.4->pyOpenSSL->Scrapy)
Downloading pycparser-2.16.tar.gz (230kB)
100% |################################| 235kB 286kB/s
Building wheels for collected packages: Twisted, pycparser
Running setup.py bdist_wheel for Twisted ... done
Stored in directory: C:\Users\DDSHARMA\AppData\Local\pip\Cache\wheels\0e\53\62\e7b4cea7df9113fb2818b224eb5d143be981568d9c43057a0a
Running setup.py bdist_wheel for pycparser ... done
Stored in directory: C:\Users\DDSHARMA\AppData\Local\pip\Cache\wheels\34\cc\b5\34e805b130a9227f0681d5517cf554d950bb0361c3a373496f
Successfully built Twisted pycparser
Installing collected packages: pyasn1, pyasn1-modules, idna, pycparser, cffi, cryptography, pyOpenSSL, attrs, service-identity, zope.interface, Twisted, w3lib, cssselect, parsel, queuelib, Scrapy
Successfully installed Scrapy-1.2.1 Twisted-16.4.1 attrs-16.2.0 cffi-1.8.3 cryptography-1.5.2 cssselect-1.0.0 idna-2.1 parsel-1.0.3 pyOpenSSL-16.2.0 pyasn1-0.1.9 pyasn1-modules-0.0.8 pycparser-2.16 queuelib-1.4.2 service-identity-16.0.0 w3lib-1.15.0 zope.interface-4.3.2
(pymote_env) C:\Users\DDSHARMA\Documents\pymote_env>
I was able to install scrapy on Python 3.5.
Check to see if you are able to install these Twisted, lxml and pyOpenSSL.
In my case I got error in installing lxml. I fixed it by downloading lxml‑3.6.4‑cp35‑cp35m‑win_amd64.whl from http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml based on your Python and windows version. (Credit to Christoph Gohlke's generosity for sharing this library.). Installed it using the following command:
pip install lxml‑3.6.4‑cp35‑cp35m‑win_amd64.whl

Categories