Installing gmpy2 on windows using pre-compiled binaries - python

I am trying to install the gmpy2 package as its an requirement for the PHE package. As suggested in "GMPY2 not installing", I have tried to install it via pre-compliled binaries from http://www.lfd.uci.edu/~gohlke/pythonlibs/.
However when I try to install it via
pip install gmpy2-2.0.8-cp36-cp36m-win32.whl
I get the following result:
C:\Users\adria\Desktop>pip install gmpy2-2.0.8-cp36-cp36m-win32.whl
Requirement 'gmpy2-2.0.8-cp36-cp36m-win32.whl' looks like a filename, but the file does not exist
Processing c:\users\adria\desktop\gmpy2-2.0.8-cp36-cp36m-win32.whl
Exception:
Traceback (most recent call last): (...)
Is it a problem that the download from http://www.lfd.uci.edu/~gohlke/pythonlibs/ is saved as zip file?
I use Python 3.6.3 on Win10.

If you try to install without specifying the file extension (i,e : pip install gmpy2-2.0.8-cp36-cp36m-win_amd64) it won't work cause it will try to download the package from pypi repository:
C:\Users\bobolafrite\Downloads>pip install gmpy2-2.0.8-cp36-cp36m-win_amd64
Collecting gmpy2-2.0.8-cp36-cp36m-win_amd64
Could not find a version that satisfies the requirement gmpy2-2.0.8-cp36-cp36m-win_amd64 (from versions: )
No matching distribution found for gmpy2-2.0.8-cp36-cp36m-win_amd64
But if you try with the extension (i,e : pip install gmpy2-2.0.8-cp36-cp36m-win_amd64.whl)
C:\Users\bobolafrite\Downloads>pip install gmpy2-2.0.8-cp36-cp36m-win_amd64.whl
Processing c:\users\bobolafrite\downloads\gmpy2-2.0.8-cp36-cp36m-win_amd64.whl
Installing collected packages: gmpy2
Successfully installed gmpy2-2.0.8

Related

How to set up a private python package which can be installed from google colab

I want to install a private package on google colab. But it is not installing the correct versions and thus does not seem to work. I have the following in setup.cfg:
requests>=2
and this in requirements.txt:
requests=2.23.0
To download my package I run the following command:
!pip install git+https://****#github.com/mypackage.git
Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/
Collecting git+https://****#github.com/mypackage.git
Cloning https://****#github.com/mypackage.git to /tmp/pip-req-build-h78dg_5o
Running command git clone -q 'https://****#github.com/mypackage.git' /tmp/pip-req-build-h78dg_5o
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Collecting requests>=2
Downloading requests-2.28.1-py3-none-any.whl (62 kB)
Installing collected packages: PyJWT, idna, cryptography, requests, typeform, msal, mypackage
Attempting uninstall: requests
Found existing installation: requests 2.23.0
Uninstalling requests-2.23.0:
Successfully uninstalled requests-2.23.0
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.
google-colab 1.0.0 requires requests~=2.23.0, but you have requests 2.28.1 which is incompatible.
Successfully installed requests-2.28.1
As seen in the output, pip installs requests-2.28.1, eventhough 2.23.0 is specified in the requirements. It seems like it uses requests>=2 to install the downloand and install the 2.28 version, uninstalling 2.23.
How should I change my package so the correct versions are downloaded?
EDIT: After solving above problem I ran into something else:
I am installing the following packages in my setup.cfg:
[options]
packages =
package_1
package_2
package_3
This install 3 different packages on my local machine from which I can import modules. However, on google colab when I try:
import package_1
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-19-f86846990b2c> in <module>()
----> 1 import package_1
/usr/local/lib/python3.7/dist-packages/package_2/python_code.py in <module>()
----> 1 from package_2.more_code import a_function
/usr/local/lib/python3.7/dist-packages/package_2/__init__.py in <module>()
----> 1 from .resources import SomeCode
ModuleNotFoundError: No module named 'package_2.resources'
---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.
To view examples of installing some common dependencies, click the
"Open Examples" button below.
it seems it does not recognize package when referenced the second time, how is this possible?

How do I fix the ERROR: Could not find a version that satisfies the requirement for uncompyle6-3.7.4-py3.8?

I have downloaded the uncompyle6-3.7.4-py3.8 egg file from pypi.org website in order to decompile a .pyc file. When I am trying to install it using the pip command in command prompt pip install uncompyle6-3.7.4-py3.8, I get the following error:
ERROR: Could not find a version that satisfies the requirement uncompyle6-3.7.4-py3.8 (from versions: none)
ERROR: No matching distribution found for uncompyle6-3.7.4-py3.8
I am using the latest version of Python (3.8). I tried to download another uncompyle file for the earlier 3.7 version, but even then I get the same error. I have also upgraded pip to its latest version. On their website it is mentioned that for Python 3.7 and above, the code in decompyle3 is generally better, yet I get the same error for pycdc.
How could I fix this error? Thank you!
You can install .whl files with pip, not .egg. In order to install .egg file you need easy_install.
Try this command:
python -m easy_install https://files.pythonhosted.org/packages/ef/91/07f46d34bf8d3bf385785b98b13ebddaa414638f553d9b33c8aa320f45cd/uncompyle6-3.7.4-py3.8.egg

Can't install libxml2 for python with whl file

I am having a very hard time installing libxml2. I am trying to use a wheel file to install it with the command line. I have Python 3.8 but I don't see any .whl files for Python 3.8. Do I need to use an earlier version of Python?
Here is the error when I attempt to install with the whl file in my Python folder:
C:\Users\Jack\AppData\Local\Programs\Python\Python38-32>pip install libxml2_python-2.9.3-cp27-none-win32.whl
ERROR: libxml2_python-2.9.3-cp27-none-win32.whl is not a supported wheel on this platform.
Wheel is installed:
C:\Users\Jack\AppData\Local\Programs\Python\Python38-32>python -m pip install wheel
Requirement already satisfied: wheel in c:\users\jack\appdata\local\programs\python\python38-32\lib\site-packages (0.33.6)
And here is some more info:
C:\Users\Jack\AppData\Local\Programs\Python\Python38-32>where python
C:\Users\Jack\AppData\Local\Programs\Python\Python38-32\python.exe
C:\Users\Jack\Anaconda3\python.exe
C:\Users\Jack\AppData\Local\Programs\Python\Python38-32>where pip
C:\Users\Jack\AppData\Local\Programs\Python\Python38-32\Scripts\pip.exe
C:\Users\Jack\Anaconda3\Scripts\pip.exe
C:\Users\Jack\AppData\Local\Programs\Python\Python38-32>where pip3
C:\Users\Jack\AppData\Local\Programs\Python\Python38-32\Scripts\pip3.exe
C:\Users\Jack\AppData\Local\Programs\Python\Python38-32>python -c"import struct;print( 8 * struct.calcsize('P'))"
32
The .whl file is valid for python 2 not 3.

Python3.6 can't install latest version of yoyo-migrations

I want to install the latest version of yoyo-migrations module.
Based on https://pypi.org/project/yoyo-migrations/ the latest version is 5.1.0 and when I try to install it using pip install yoyo-migrations it installs the v5.0.5 and when using this command pip install yoyo-migrations==5.1.0 it gives me this error.
Collecting yoyo-migrations==5.1.0 Could not find a version that
satisfies the requirement yoyo-migrations==5.1.0 (from versions: 1, 2,
3, 4, 4.1.0, 4.1.1, 4.1.2, 4.1.3, 4.1.4, 4.1.5, 4.1.6, 4.2.0, 4.2.1,
4.2.2, 4.2.3, 4.2.4, 4.2.5, 5.0.0, 5.0.1, 5.0.2, 5.0.3, 5.0.4, 5.0.5) No matching distribution found for yoyo-migrations==5.1.0
If you look at the files for that version here you will see that the only available file for that version is
yoyo_migrations-5.1.0-py2-none-any.whl (42.1 kB)
The py2 part indicates that this wheel is only good for python2, and not your version of python3, so pip is correct when it tells you that it can't find a suitable version. However, the version you're trying to download is only a few hours old, perhaps there will be additional files there soon.
Or you can install the develop version.
pip install -e hg+https://bitbucket.org/ollyc/yoyo#egg=yoyo-migrations

For python, install hdf5/netcdf4

Doing this on a Linux Mint 17.1.
When I try:
pip install hdf5
I get the error
"Could not find a version that satisfies the requirement hdf5 (from versions: )
No matching distribution found for hdf5"
I'm trying in the long run to install netcdf4 but can't do that until I get hdf5 installed. Supposedly from when I was trying to do this last week, with netcdf4, I should be using the pip install netcdf4, err hdf5...at least maybe in the case of hdf5.
If I try pip install h5py I get that the message saying:
Requirement already satisfied (use --upgrade to upgrade): h5py in ./anaconda3/lib/python3.5/site-packages
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.6.1 in ./anaconda3/lib/python3.5/site-packages (from h5py)
Requirement already satisfied (use --upgrade to upgrade): six in ./anaconda3/lib/python3.5/site-packages (from h5py)
Yet if I go ahead and try pip install netcdf4 it comes up and says:
Collecting netcdf4
Using cached netCDF4-1.2.3.1.tar.gz
Complete output from command python setup.py egg_info:
Package hdf5 was not found in the pkg-config search path.
Perhaps you should add the directory containinghdf5.pc'
to the PKG_CONFIG_PATH environment variable
No package 'hdf5' found
cython version 0.23.4 found ...
reading from setup.cfg...
HDF5_DIR environment variable not set, checking some standard locations ..
checking /home/meant2b ...
checking /usr/local ...
checking /sw ...
checking /opt ...
checking /opt/local ...
checking /usr ...
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-pq3yt4ek/netcdf4/setup.py", line 286, in <module>
raise ValueError('did not find HDF5 headers')
ValueError: did not find HDF5 headers
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-pq3yt4ek/netcdf4/`
When I search the files I don't find a hdf5.pc file.
Is there a difference between h5py and hdf5? Do I have to compile and install hdf5 from the individual files or can I pip install.
What do I have to do to be able to install both hdf5 and netcdf4?
You need to install the HDF5 libraries for your Linux distribution. In Ubuntu is:
sudo apt-get install libhdf5-serial-dev netcdf-bin libnetcdf-dev
See this link.
I had the same issue in Debian 8. To fix it, as root, I installed the libraries, then linked the serial headers to a include dir inside the hdf5 libraries, exported the HDF_DIR path and installed netCDF4:
# apt-get install -y libhdf5-dev libnetcdf-dev
# ln -s /usr/include/hdf5/serial /usr/include/hdf5/include
# export HDF5_DIR=/usr/include/hdf5
# pip install netCDF4
I had the same error under macOS Catalina. Had to install the hdf5 and netcdf4 packages from Homebrew:
brew install hdf5 netcdf4
Afterwards, pip3 install netcdf4 worked fine.

Categories