Ignore specific package version when running setup.py - python

I'm running into the error discussed here when running setup.py: numpy 1.19.4 fails to install due to a windows bug. The current workaround is to use numpy 1.19.3 instead. However, I'm trying to run a setup.py file that doesn't list numpy directly as a dependency, but uses several packages that has numpy as a sub-dependency.
Because of this, I cannot directly pin numpy to 1.19.3. In this scenario, is there a simple way to get the install script working? In other words: how can I modify the setup.py file so that it won't install any package (versions) that has numpy 1.19.4 as a dependency?

The available dependency relations include !=
numpy!=1.19.4

Related

Is it possible to enforce a python package to be installed before a dependency is with setuptools?

I have a dependency on a python source package (no wheels) that will build a c-extension with conditional features depending on whether or not it can detect numpy on the Python path (with an exception check on import numpy in their setup.py).
The key problem is I need to distribute a python package that requires these conditional numpy features which means ensuring numpy is available before the dependency I have is installed.
Concretely, I would like to be able to run the command pip install my_package_name and have the dependency installed with a guarantee that the c-extension of my dependency installed with numpy features enabled.
I do not know of a way to do this on a fresh environment without performing a separate initial install of numpy.
Is there anything I can do? If not is there something I should suggest to the maintainer of my python package dependency?
Thanks for your time in advance!

In package uploaded to pypi not checking if package requirements already installed, though install of same code from github does

This is a followup to this question
Installing a pip package with cupy as a requirement puts install in never ending loop
Where somehow a pip package was not able to detect that cupy is already installed, and tried to re-install it.
The solution given was to use
try:
import cupy
except Exception:
install_requires.append('cupy')
Which worked for when I tried to install through github with
!pip install https://github.com/Santosh-Gupta/SpeedTorch/archive/master.zip
However, when I uploaded by code to pip and tried to run it, it's re-installing cupy again
!pip install SpeedTorch
I am using Goolgle colab, which already has cupy installed. For convenience, here's a link to the notebook I am using
https://colab.research.google.com/drive/17KrdcHh29cpFMel_oYnOTkA1dNElolZ1
And here is my setup.py file
https://github.com/Santosh-Gupta/SpeedTorch/blob/master/setup.py
This problem may be unique to cupy, since I do not have this issue with other python packages.
This is not issue specific to CuPy. You should not modify install_requires in setup.py if you want to distribute your package as a wheel. setup.py runs when building a wheel package, not when installing it. In other words, install_requires is determined depending on whether cupy is available when building a wheel package.

Not able to install numpy or nltk python-modules

I am having a strange issue installing numpy or nltk python-modules in my windows-7 machine. I have successfully installed Python 2.7.12 but I get this error when I type pip install numpy as in this screenshot. I have also included the directory of pip.exe in the PATH. Any help would be appreciated.Thank you :)
Installing such these things in windows are sometime difficult, specially for someone new to python packages(also for some experts!)
Try to use Anaconda for windows: https://www.continuum.io/downloads#_windows
This install a python for you and many requirement packages(e.g Numpy, Scipy, Scikit and many more)
You can use older version of Anaconda, for python2.x if you want strictly python2.x
An alternative way is to download Numpy from github and then install it as a python package, that contain setup.py file
python setup.py install
Or you can download Numpy wheel package, then install it localy with pip

Cannot import matplotlib in Python 3

I want to install matplotlib on windows. To do this I tried those lines,
git clone https://github.com/matplotlib/matplotlib
cd matplotlib
py setup.py build
py setup.py install
which I found at this link
But I think the installation does not succesfully occured. This is result of py setup.py install:
So still following imports does not work;
import matplotlib.pyplot as plt
import matplotlib.animation as animation
An error says Unresolved import. So I am supposing this is because freetype and png did not installed.
Now I found freetype.dll and installed it but where should I put that file?
Any idea about this problem.
Yes. Matplotlib has some dependencies that need to be installed in order for the library to function fully. Quoting:
Once you have satisfied the requirements detailed below (mainly
python, numpy, libpng and freetype), you can build matplotlib:
cd matplotlib python setup.py build python setup.py install
To be sure of the correct procedure check the build instructions. If this process seems somewhat complex (it sometimes is) you can consider Python distributions such as:
1) WinPython
2) Python XY
3) Anaconda
, that already bring several libraries by default and making it a lot easier to work with Python (and extensions).

Install missing dependencies for scipy

I'm trying to install scipy but when I finish installing, I can't import it. is there any GUI for easy installation? The general information:
Windows 7 - Python 2.7 - scipy 0.11.0 - I followed the steps in abel.ee.ucla.edu/cvxopt/install/index.html) for windows to install the libraries needed. I ran the setup for scipy using python setup.py install in command line and in the setup.py directory.
The error messege error link
If you are looking for a windows installer you can find one here: http://www.lfd.uci.edu/~gohlke/pythonlibs/
But as it says: These are unofficial, unsupported and you might have to reinstall numpy and everything depending on numpy from there too!
Read the instructions very careful!

Categories

Resources