Using numpy (and others module) - python-3.x

It's maybe a stupid thing, but I can't resolve it.
I used pip3 to install numpy, scipy... When I rewrote the instruction in command line, it said that
"Requirement already satisfied: numpy in
/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages
(1.16.2)"
But when I used Python 3.7.2 it said that
"ModuleNotFoundError: No module named 'numpy'"
So that I cannot use numpy actually. I tried also to remove python, and reinstall it via brew. But nothing happen.
Also, I've got a problem with pip. When I do pip3 install --upgrade pip, it answers
You are using pip version 18.1, however version 19.0.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Related

pip install Pillow fails

I can't install pillow on my computer anymore. When I tried pip install Pillow, I get warnings and then 2 errors :
ERROR: Could not find a version that satisfies the requirement pillow (from versions: none)
ERROR: No matching distribution found for pillow
I saw a lot of people in the same case and I tried all the solutions but nothing worked. Do you have any idea on how to re-install pillow?
Install with whatever you use to run Python, not pip directly. For example:
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade Pillow
See https://snarky.ca/why-you-should-use-python-m-pip/ for more details.

Can't install PymuPDF although python Libary have PymuPDF

I tried to install PyMuPDF on Python 3.9 when first I installed by pip install PymuPDF and re-checked by pip list like this"
But when I imported PyMuPDF:
ModuleNotFoundError: No module named 'PyMuPDF'
Next, I tried to install PymuPDF from doc, it said I need install MuPDF first, and install with Wheel, I tried both:
pip install C:\Users\Admin\Desktop/PyMuPDF-1.19.6-cp310-cp310-win_amd64.whl and pip install PyMuPDF-1.19.6-cp310-cp310-win_amd64.whl but reviced error:
yMuPDF-1.19.6-cp310-cp310-win_amd64.whl is not a supported wheel on this platform.
What should i do to install PyMuPDF, thank you all.
PyMuPDF is available with a wheel under all Windows versions - you should have no problem at all.
But please follow this procedure:
Make sure your pip is the current one. This ensures that any changes in supported platform tags are known to pip.
Then install PyMuPDF.
So overall
py -3.10 -m pip install -U pip
py -3.10 -m pip install -U pymupdf
This should simply work!
In your script however you must do import fitz - this is the top-level name of the package.

Python Pip doesn't work after updating to 19.3.1

After updating to the newest version of pip (19.3.1) with python 3.7.3, I can no longer use pip. When I run pip install package, I get the following error: TypeError: 'module' object is not callable. When trying to fix this error, I found that a common suggestion was running python -m pip install package. While this fixed my original problem, I get this different error: ModuleNotFoundError: No module named 'pip._vendor.requests._internal_utils'. Keep in mind I am on Windows 10 If anyone can help me, it would be very much appreciated!
I cannot guarantee a solution, here are a few suggestions to try:
pip3 install package
If that doesn't work:
python -m pip install package
If it still does not behave, try the following command which will reinstall pip.
python -m pip install --upgrade --force-reinstall pip
The final option is to uninstall python and reinstall your desired 64bit version of Python.

pip3 cannot be found after installing python3 and pip3 on a mac

python2 is installed on every mac and I installed python3 and used it a lot with the standard libraries. Now I wanted to use pip3 as I did with pip and it says:
-bash: pip3: command not found
I downloaded get-pip.pyfound in StackOverflow's answers and with installing it I got:
Requirement already up-to-date: pip in /usr/local/lib/python3.6/site-packages
In addition to that I tested with which pip3 and there was no output, just the new line with the normal shell. And with which pip there is the location output like I expected:
/usr/local/bin/pip
I installed python3 with the package and last month I installed brew. Maybe this created the conflict because I think I had use pip3for some libraries my installation of python3.
(What possibility do I have to use python3 without having to uninstall python2 and python3 because I need both of them and got the answer that it's no problem to install both of them?)
Thanks #phd for linking to another question. With
alias pip3='python3 -m pip'
in ~/.bash_profile I can use pip3 as used.
But I do want to know if there is still a place where pip3 is located in python3 and how I can find it?
Thanks a lot.
macOS 10.12.6 / python 2.7.10 and 3.6.4
which python>> /usr/bin/python
which python3>> /usr/local/bin/python3

Confusion with virtualenvs and Python packages

In my python program (run by a virtualenv using python3.5), I need to use the Pillow library to process an image.
ImportError: No module named 'Pillow'
tells me that Pillow is not installed in the virtualenv.
But, when I run pip install Pillow, I get back:
Requirement already satisfied: Pillow in /usr/lib/python3/dist-packages
If the pip I am using is from the virtualenv, then why is it looking in /usr/lib/python3/dist-packages to check if the package is already installed?
Just to make sure, I run type python and type pip to confirm that these 2 programs are from my virtualenv, and they are:
python is hashed (/home/nelson/.virtualenvs/MainEnv/bin/python)
pip is hashed (/home/nelson/.virtualenvs/MainEnv/bin/pip)
sudo was not used when creating the virtualenv (I know because this had already caused problems for me) or when trying to pip install; so where is the flaw in this logic? How can I install Pillow in my virtualenv / How can I import Pillow?
Pillow is a fork of PIL. Hence from PIL import Image. See https://pillow.readthedocs.io/en/4.2.x/handbook/tutorial.html
If you created the virtual environment with --system-site-packages, the virtual environment has access to the global site-packages modules.
You need to re-create the virtual environment without --system-site-packages option if you don't want that.

Resources