PIP installs correctly but does nothing when executed - python

I'm having trouble with Python.
I downloaded Python and pip without error.
But when I run pip install flask, it just waits a second and goes back to the command prompt.
Same issue when I run python -m pip install flask.
However, it works when I run py -m pip install flask.
Any ideas why this happens? Thanks!
My path is as follows:
%USERPROFILE%\AppData\Local\Programs\Python\Python38
%USERPROFILE%\AppData\Local\Programs\Python\Python38\Scripts
Message when installing pip.
Collecting pip
Using cached pip-20.1.1-py2.py3-none-any.whl (1.5 MB)
Installing collected packages: pip
Successfully installed pip-20.1.1

You might have various versions of python. Can you just try your pip install by mentioning the version
python3.7 -m pip install flask

Related

ModuleNotFoundError: No module named 'Cython' even though Cython is installed in Azure Devops

I'm setting up some CI/CD for a Python app (Azure Function) using Azure Devops and I've stumbled upon an issue with one of the requirements. The error I receive is ModuleNotFoundError: No module named 'Cython' while trying to install pymssql-2.1.4. Before this requirement, I have set a Cython==0.29.21 to be installed and it is installed as it can be seen through out the logs as
Collecting Cython==0.29.21
Downloading Cython-0.29.21-cp38-cp38-manylinux1_x86_64.whl (1.9 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.9/1.9 MB 73.5 MB/s eta 0:00:00
I'm not sure why this error happens, I did some research and saw that it can be a problem with the pip version so I update the pip before doing the installation but the error keeps persisting. This is my yaml code for the part where I install the requirements.
python3 -m venv worker_venv
source worker_venv/bin/activate
python3 -m pip install pip --upgrade
pip3 install setuptools
pip3 install -r requirements.txt
I use python 3.8 version and ubuntu 20.04. Does somebody know how can I fix this?
I managed to solve it myself. In my case, for pymssql-2.1.4, I downgraded python to 3.7, downgraded pip to 20.0.2 and manually install cython before running the pip install -r requirements.txt. My new yaml now looks like
python3 -m venv worker_venv
source worker_venv/bin/activate
pip3 install pip==20.0.2
pip3 install --upgrade setuptools
pip3 install --upgrade cython
pip3 install -r requirements.txt
This did fix the problem and I no longer struggle with this kind of error. Posting this in case someone finds it useful

Python, pip install stuck on collecting "module_name"

Using freshly installed python 3.5.2 on windows 10, trying to install libraries via cmd, gives such result:
C:\Python35>pip install theano
Collecting theano
C:\Python35>pip install numpy
Collecting numpy
C:\Python35>pip list
pip (8.1.1)
setuptools (20.10.1)
C:\Python35>
The question is simple, how to make pip to install?
About trial and error. I did try to find solution, yes, and here is what does not work:
Using --no-cache-dir
pip install numpy-1.16.1-cp37-cp37m-win_amd64.whl same for Theano
python -m pip install and every special combination of parameters like pip3 -vvv and so on.
manually deleted the contents of the cache directory
ran as administrator, launched cmd from python folder
reinstalled python, restarted pc, have internet connection

ERROR: Could not build wheels for Kivy which use PEP 517 and cannot be installed directly

I've been trying to install kivy on windows10 machine and I did not get an expected output, instead, I got a series of weird error messages. First I ran the following commands:
python -m pip install --upgrade pip wheel setuptools
python -m pip install docutils pygments pypiwin32 kivy.deps.sdl2 kivy.deps.glew
python -m pip install kivy.deps.gstreamer
python -m pip install kivy.deps.angle
python -m pip install pygame
And as far as I know, everything went right.
After that, I ran this command: python -m pip install https://github.com/kivy/kivy/archive/master.zip
Command output helped me break down the process of executing it.
First I got an error message while "Getting requirements to build wheel".
error message:
I got this error while "Preparing wheel metadata" and "Building wheel for Kivy (PEP 517)" as well. I think that it is worth mentioning that every time I said that error occurred, it occurred twice, one after another.
After that, I got a huge error:
You can download the test file with an error message on this link: https://filesend.standardnotes.org/send/BPQTjNM3aiUyRXOtfA3A#ZGI2ZDUzMWU2MmYzNTlhNTVlODEw
Note: All the commands that I executed were executed in cmd ran by the administrator.
If anyone can explain to me what is going on I would highly appreciate it!
Going by related issues here - ERROR: Could not build wheels for pendulum which use PEP 517 and cannot be installed directly and pip failing to build wheels for scipy
The answers seem to suggest that downgrading pip version will likely solve the problem. But before that please try
pip install --upgrade pip setuptools wheel
Instead of
python -m pip install --upgrade pip wheel setuptools
and see if it solves. If not, downgrade your pip by doing
python -m pip install --force-reinstall pip==18.1
If none of these work then your only viable solution is to use Kivy within Anaconda. You can see more on installation from here.
If I am not mistaken, this error means that you are trying to run 64-bit application on a 32-bit system. Install python version which corresponds to your OS, and then try again.
Also, make sure you have the newest version of C++ Redistributable installed.

Update python library offline

I need to update offline a library in Python.
I have downloaded the library with pip download and then I try to update the library with the command:
pip install --no-index --user --find-links /tmp/pip/ --upgrade Werkzeug==0.15.5
which gives:
Ignoring indexes: https://...
Collecting Werkzeug==0.15.5
Installing collected packages: Werkzeug
Successfully installed Werkzeug-0.11.15
and then the library stays in the same version!
pip freeze | grep Wer
Werkzeug==0.11.15
Any ideas why this happens?
UPDATE: After the comment from #hoefling I rerun with the -vvv option and this is what I got:
pip install --no-index --user --find-links /tmp/pip2/ -vvv Werkzeug==0.15.5
Ignoring indexes: https://pypi:pypi#..../simple/
Collecting Werkzeug==0.15.5
0 location(s) to search for versions of Werkzeug:
Skipping link /tmp/pip2/werk/ (from -f); not a file
Found link file:///tmp/pip2/werk/Werkzeug-0.15.5-py2.py3-none-any.whl, version:
0.15.5
Local files found: /tmp/pip2/werk/Werkzeug-0.15.5-py2.py3-none-any.whl
Using version 0.15.5 (newest of versions: 0.15.5)
Installing collected packages: Werkzeug
Successfully installed Werkzeug-0.11.15
Cleaning up...
Try this command:
pip install Werkzeug-0.15.5.tar.gz
and the result must be like this:
Processing ./Werkzeug-0.15.5.tar.gz
Installing collected packages: Werkzeug
Running setup.py install for Werkzeug ... done
Successfully installed Werkzeug-0.15.5
This behaviour can happen because pip by default works with system Python which is located in /usr/bin/ on Linux. When installing the package, by giving Python --user flag your package is installed in your user's version of Python, probably located somewhere in ~/.local/.
To solve the problem you can install the package to your system Python, which is generally not recommended without --user flag. Another option is to use virtual environments and have the distribution that is made specifically for your project. Currently the recommended way is using venv.
$ python -m venv env
$ source env/bin/activate
(env) $ pip install ... (packages you need to install without --user flag)
(env) $ pip freeze
# should give you the packages you installed
This can help you not only with this example, but it can always keep your system Python installation clean and if you mess something up, you will only mess the environment you are having for specific project.

How to downgrade the installed version of 'pip' on windows?

On a windows 7 machine I have pip version 1.5.6 installed:
pip 1.5.6 from C:\Users\dietz\PNC\tas\ENV\lib\site-packages (python 2.7)
In order to find the reason for an error I want to install a different version of pip, which worked fine for me. So how can I uninstall pip and install version 1.2.1 instead?
pip itself is just a normal python package. Thus you can install pip with pip.
Of cource, you don't want to affect the system's pip, install it inside a virtualenv.
pip install pip==1.2.1
If downgrading from pip version 10 because of PyCharm manage.py or other python errors:
python -m pip install pip==9.0.1
If you want to upgrade or downgrade to different version of pip, better use --upgrade option at one go instead doing it in two steps. i.e. first uninstalling the existing and then re-installing to new version, below does both in one go as shown below.
USE: Executed on WIN10 with Bash
python -m pip install --upgrade pip==19.2.3
$ python -m pip install --upgrade pip==19.2.3
Collecting pip==19.2.3
Using cached pip-19.2.3-py2.py3-none-any.whl (1.4 MB)
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 21.3.1
Uninstalling pip-21.3.1:
Successfully uninstalled pip-21.3.1
Successfully installed pip-19.2.3
well the only thing that will work is
python -m pip install pip==
you can and should run it under IDE terminal (mine was pycharm)
If you have to downgrade pip version do following steps:
step1. pip uninstall pip
step2. pip install pip==version number you want to install or downgrade
step3. check version of pip using pip --version
This process also works when any other package giving error exit code(2) you can follow these steps and install your package.

Categories

Resources