Can't install PymuPDF although python Libary have PymuPDF - python-3.x

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.

Related

pip installs modules for python 2.7

I want to install a module with pip, in my case pydub.
However pip install pydub installs pydub in /home/<user>/.local/lib/python2.7/
So when I run my script
python3 myScript.py
it tells me
ModuleNotFoundError: No module named 'pydub'
How do I get pip to install pydub for 3.x rather than 2.7?
Use pip3 install xxx, or better yet, python3 -m pip install xxx. The problem here is that by default pip is aliased to python2's installation.

How to install fenics in Ubuntu using PIP for a particular python environment?

I want to install fenics in Ubuntu 20.
First I made a python environment using:
sudo apt install python3-venv
Then inside the folder I want to make an environment I open a terminal and use:
python3 -m venv myproject
myproject is the name of the environment I made.
I then activate my environment:
source myproject/bin/activate
To install fenics for this particular environment while I activated the environment, I use:
pip install fenics
I verify the installation using pip list which returns:
Package Version
-------------- --------------
fenics 2019.1.0
fenics-dijitso 2019.1.0
fenics-ffc 2019.1.0.post0
fenics-fiat 2019.1.0
fenics-ufl 2019.1.0
mpmath 1.1.0
numpy 1.19.4
pip 20.0.2
pkg-resources 0.0.0
setuptools 44.0.0
sympy 1.7.1
I try to import fenics using:
python -c "import fenics"
But I get the error below stating there is not fenics module:
raceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'fenics'
What is the problem? Hopefully, after successful installation of fenics, I can install Spyder and other python packages and will be able to use fenics inside spyder.
Edit
I want to install fenics in a python virtual environment.
The issue here is that fenics is just a meta-package and it does not contain any library that you can use in your Python code.
Quoting from the README for the fenics project :
This package contains a single file, setup.py, that allows all of the FEniCS Python components to be installed from PyPI using pip:
pip3 install fenics
Actual use of the library is done via
import ffc
All different components are under this package. For example, fenics-fiat is available as ffc.fiatinterface.
Fenics library of python
If you have installed pip than you have to use pip install fenics. If you have installed pip3 than `pip3 install fenics
I have already installed both.
sudo apt update
sudo apt install python3-pip
Install pip for Python 2 with:
sudo apt install python-pip
After doing pip3 install fenics,write python3 -c import ffc to import it. If this works, it has been imported. It is called ffc, not fenics

pip install not working -- How to install/upgrade PyPi packages with pip v10 and above, using Python?

After upgrading my pip to version 10 using pip3 install --upgrade pip and above I cannot I want to install/upgrade PyPi packages using pip3 install PyPiPackageName as I get the following error:
from pip import main
ImportError: cannot import name main
I wonder how I can install PyPi packages using pip when I'm using new versions of pip? I've seen some people use pyhton3 to do this but doing python3 -m pip install --upgrade pip gave me the following error and I cannot upgrade pip to higher versions:
/usr/bin/python3: No module named pip
Before doing python3 -m pip install --upgrade pip I do python3 -m pip install -U pip and I get the following error:
/usr/bin/python3: No module named pip
So I'm confused on what I need to do to be able to upgrade or install PyPi packages.
In addition to executing the following:
curl https://bootstrap.pypa.io/get-pip.py | python3.6
I also had to make sure python3 is using Python 3.6 otherwise Python 3.5 is used (which does not come with pip by default). So I did the following and things work fine now:
ln -s /usr/bin/python3.6 /usr/local/bin/python3

Issue installing shapely Python Package

I am running python 3.6 on windows and am attempting to install Shapely using
pip install shapely==1.6b2
It is giving me the following errors
Command "python setup.py egg_info" failed with error code 1 in C:\Users\Cameron\AppData\Local\Temp\pip-build-242ae_ih\shapely\
I have seen the other posts about this issue and have tried:
pip install --upgrade setuptools
pip install ez_setup
easy_install -U setuptools
Nothing seems to work and I am not sure what to do next. Any advice would be appreciated.
Thanks
You may try to use the binary from this unofficial site. Just use pip install {wheel file name} to install it.
Shapely‑1.5.17‑cp36‑cp36m‑win32.whl (32-bit)
Shapely‑1.5.17‑cp36‑cp36m‑win_amd64.whl (64-bit)
Hope this would make the installation easier.
I had a similar error for installing shapely-1.5.17 via pip install shapely, and installing this made the pip install command work thereafter:
sudo apt-get install libgeos-dev
As of 2020, you can now simply install Shapely for Windows with:
pip install shapely
(you many need --upgrade to get at least version 1.7.0, when binary wheels were added for Windows)

Use or install different versions of python3 pip

I'm trying to install packages for my python 3.5.0 versus my python 3.4.3
I can run both by typing either python3.4 or python3.5
I have pip2 and pip3. I also ran the script sudo easy_install3 pip, which made me be able to use pip3.4 But I am still having trouble installing modules for python3.5. pip3 just installs for python3.4
I am looking to install termcolor for python3.5 and I am having no success. Can anyone help?
I am on Windows, and you appear not to be, but maybe the following will help.
If pip is in your system's equivalent of python35/Lib/site-packages, then python3.5 -m pip should run pip so that it installs into the 3.5 site-packages.
If you do not have pip in the 3.5 site-packages, copy its directory, along with its dependencies (pip....dist-info/, setuptools/, setuptools....dist-info/, and easyinstall.py) from the 3.4 site_packages.
Or, if pip3 or even pip3.4 is in python35/Scripts, run it with its full path name so you are not running the 3.4 version.

Resources