No matching distribution found when installing from local python index - python-3.x

I'm trying to install packages from local package index. I have a package named scikit_image-0.14.0-cp35-cp35m-manylinux1_x86_64. In pip requirements file the package is defined as scikit-image==0.14.0. When i try to run
pip install --index my_url requirements.cfg
I get Error: "No matching distribution found for pip_requirements.cfg".
When i install from PyPI all works well. Am I missing something?

The command you posted is trying to install the requirements.cfg project, which doesn't exist. Perhaps you mean:
$ pip install --index my_url -r requirements.cfg
to install from a requirements file called requirements.cfg?

Related

Error installing psycopg2 on macOS with building wheel [duplicate]

I'm attempting to make a website with a few others for the first time, and have run into a weird error when trying to use Django/Python/VirtualEnv. I've found solutions to this problem for other operating systems, such as Ubuntu, but can't find any good solutions for Mac.
This is the relevant code being run:
virtualenv -p python3 venv
source venv/bin/activate
pip install -r requirements.txt
After running that block, I get the following errors:
AssertionError
Failed building wheel for django-toolbelt
Running setup.py bdist_wheel for psycopg2
...
AssertionError
Failed building wheel for psycopg2
Failed to build django-toolbelt psycopg2
I believe I've installed the "django-toolbelt" and "psycopg2", so I'm not sure why it would be failing.
The only difference I can think of is that I did not use the command
sudo apt-get install libpq-dev
as was instructed for Ubuntu usage as I believe that installing postgresql with brew took care of the header.
Thanks for any help or insight!
For MacOS users
After trying all the above methods (which did not work for me on MacOS 10.14), that one worked :
Install openssl with brew install openssl if you don't have it already.
add openssl path to LIBRARY_PATH :
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/
install psycopg2 with pip pip3 install psycopg2
I had the same problem on Arch linux. I think that it's not an OS dependant problem. Anyway, I fixed this by finding the outdated packages and updating then.
pip uninstall psycopg2
pip list --outdated
pip install --upgrade wheel
pip install --upgrade setuptools
pip install psycopg2
I was also getting same error.
Using Python 3.7.3 and pip 19.1.1.
I used following command.
pip install psycopg2-binary==2.8.3
TDLR
If you aren't used to installing Python C-extensions, and psycopg2 isn't a core part of your work, try
pip install psycopg2-binary
Building Locally
psycopg2 is a C-extension, so it requires compilation when being installed by pip. The Build Prerequisites section of the docs explain what must be done to make installation via pip possible. In summary (for psycopg 2.8.5):
a C compiler must be installed on the machine
the Python header files must be installed
the libpq header files must be installed
the pg_config program must be installed (it usually comes with the libpq headers) and on $PATH.
With these prerequisites satisfied, pip install psycopg2 ought to succeed.
Installing pre-compiled wheels
Alternatively, pip can install pre-compiled binaries so that compilation (and the associated setup) is not required. They can be installed like this:
pip install psycopg2-binary
The docs note that
The psycopg2-binary package is meant for beginners to start playing with Python and PostgreSQL without the need to meet the build requirements.
but I would suggest that psycopg2-binary is often good enough for local development work if you are not using psycopg2 directly, but just as a dependency.
Concluding advice
Read the informative installation documentation, not only to overcome installation issues but also to understand the impact of using the pre-compiled binaries in some scenarios.
I had same problem and this appears to be a Mojave Issue, I was able to resolve with:
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
For Mac OS X users:
1. First check your postgresql path by running this command in terminal:
pg_config
If this fails lookup how to add pg_config to your path.
2. Next install Xcode Tools by running this command in terminal:
xcode-select --install
If you have both those sorted out now try to install psycopg2 again
For MacOS users, this question has the correct solution:
install command line tools if necessary:
xcode-select --install
then
env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip install psycopg2
I was also facing the same after running all the above commands, but the following two commands worked for me:
Instead of pip, use this:
sudo apt-get install libpq-dev
then run this command:
pip install psycopg2
On OS X, I was able to solve this by simply upgrading wheel before installing psycopg2:
pip install --upgrade wheel
For OSX Sierra users, it seems that an xcode update is the solution: Can't install psycopg2 package through pip install... Is this because of Sierra?
I tried all the above solutions but they did not work for me. What I did was change the psycopg2 version in my requirements.txt file from psycopg2==2.7.4 to psycopg2==2.7.6
Is your error message complete? the most encountered reason for failing to install psycopg2 on mac from pip is pg_config is not in path.
by the way, using macports or fink to install psycopg2 is more recommended way, so you don't have to worry about pg_config, libpq-dev and python-dev.
plus, are using Python 3.5? then upgrage your wheel to > 0.25.0 using pip.
I faced the same issue, but the answers above didn't work for me.
So this is what I did in my requirements.txt
psycopg2-binary==2.7.6.1 and it worked fine
I had this issue on several packages, including psycopg2, numpy, and pandas. I simply removed the version from the requirements.txt file, and it worked.
So instead of psycopg2-binary==2.7.6.1 I just had psycopg2-binary.
I know you are asking for development environment but if you are deploying on server say, Heroku. Just add below line in the requirements.txt of your project.
django-heroku==0.3.1
As this package itself will install the required packages like psycopg2 on server deployment.So let the server(heroku) should take care of it.
sudo apt install libpq-dev python3.X-dev
where X is the sub version,
these should be followed by :
pip install --upgrade wheel
pip install --upgrade setuptools
pip install psycopg2
Enjoy !!!
I solved my problem by updating/installing vs_BuildTools. The link to the software was given in the error itself.
Error Image
Fixed by installing python3.7-dev: sudo apt install python3.7-dev, based on the link.
Python: 3.7
Ubuntu: 20.04.3 LTS

How to fix 'Could not find a version that satisfies the requirement' for install_requires list when pip installing in custom package?

I am trying to build my own Python package (installable by pip) using the twine package. This is all going well right up until the point where I try to pip install my actual package (so after uploading to PyPi).
So I first run:
python3 setup.py sdist bdist_wheel
In which my setup.py install_requires list looks like this:
install_requires=[
'jupyter_kernel_gateway==2.4.0',
'pandas==1.0.2',
'numpy==1.18.1',
'azure-storage-blob==2.0.1',
'azure-datalake-store==0.0.48',
'psycopg2-binary==2.8.4',
'xlsxwriter==1.2.6',
'SQLAlchemy==1.3.12',
'geoalchemy2==0.6.3',
'tabulate==0.8.2',
'pyproj==1.9.6',
'geopandas==0.4.0',
'contextily==0.99.0',
'matplotlib==3.0.2',
'humanize==0.5.1',
'ujson==1.35',
'singleton-decorator==1.0.0',
'dataclasses==0.6',
'xlrd==1.2.0'],
In my understanding, these install_requires would be installed by pip when installing my own package.
After this I run
python3 -m twine upload --repository testpypi dist/*
To actually upload my package to PyPi. However, when pip installing my package, I get errors that say there are no versions that satisfy the requirements for a lot of the listed requirements. E.g.: ERROR: Could not find a version that satisfies the requirement psycopg2-binary==2.8.4
When I manually install these packages (e.g. pip install psycopg2-binary==2.8.4), they do get installed.
Is there any way to make the pip install of my package actually install the install_requires requirement list succesfully?
You didn't show how your pip install-ing your package, but I'm guessing you're using something like:
pip install your_project --index-url https://test.pypi.org/simple
The issue is that TestPyPI doesn't contain copies of your dependencies that exist on PyPI. For example:
Exists: https://pypi.org/project/psycopg2-binary/2.8.4/
Does not exist: https://test.pypi.org/project/psycopg2-binary/2.8.4/
You can configure pip to fall back on TestPyPI when a package is missing instead by specifying --extra-index-url instead:
pip install your_project --extra-index-url https://test.pypi.org/simple

How to install torch==0.3.1 in python=3.6

I am trying to install deepmatcher package in python 3.6. To let this package to run in python you need have a torch==0.3.1 version. So I am trying to install torch==0.3.1 by running :
pip install torch==0.3.1
Error during installation:
Collecting torch==0.3.1
ERROR: Could not find a version that satisfies the requirement torch==0.3.1 (from versions: 0.1.2, 0.1.2.post1)
ERROR: No matching distribution found for torch==0.3.1
I even tried installing it using "peterjc123" package but still unable to uninstall it.
torch 0.3.1 is not listed official anymore. To install torch 0.3.1 one can either build it by source or using a whl file for the specific version.
Using a whl file
whl files can be found here provided by pytorch
The downloaded file can then be installed with pip install [path to downloaded file]
Build by source
To build torch by source one can checkout the desired version via git
git checkout v[version number]
For torch==0.3.1 this would be git checkout v0.3.1
After this follow the install instructions provided by README.md
More information can be found at: https://pytorch.org/get-started/previous-versions/
check if you have right python installed for you os architecture or
create a virtual env using conda and then try installing its better this way

setuptools, use package on local system instead of getting it from PyPI

There is an open-source python package that I want to work on (toga-android). To test the code I write, I have to be able to build my own project that has said open-source package as a dependency. My project has to be built with setuptools, so I need setuptools to fulfill the dependency using my version of the package, and not get the package from PyPI.
The problem is that setuptools always gets the package from PyPI.
Whenever I build with setuptools I see:
Collecting toga-android==0.3.0.dev8
Downloading https://files.pythonhosted.org/packages/92/fe/348a39e2e0bbcac2d3ed511dd2b62943b488e7dcb8097c437416caf1c179/toga_android-0.3.0.dev8-py3-none-any.whl
or
Collecting toga-android==0.3.0.dev8
Using cached https://files.pythonhosted.org/packages/92/fe/348a39e2e0bbcac2d3ed511dd2b62943b488e7dcb8097c437416caf1c179/toga_android-0.3.0.dev8-py3-none-any.whl
Clearly it is getting the package from PyPI or using a cached version from it.
I have installed my version using pip install -e . , and that has no effect. I have also tried including the package's source in my project's directory with setup.py. Setuptools apparently includes this code because syntax errors there make the build fail, but it doesn't recognize that it can satisfy the dependency. It still gets the package from PyPI and any modules imported from the package are the PyPI versions.
How can I use of custom version of a package that is also in PyPI as a setuptools dependency?
Steps to reproduce:
pip install briefcase (using or not using virtualenv does not matter)
git clone https://github.com/pybee/toga.git
cd ~/toga/src/core; sudo pip install -e .
cd ~/toga/src/android/; sudo pip install -e .
cd ~/toga/examples/tutorial0
python setup.py android
The output will show that an older version of toga-android is downloaded even though it was already installed with pip.

How to install library

I am a little bit confused....
I installed anaconda on my computer (I have windows 10).
Normally, when I want to install a package I simply do "pip install package_name" or "conda install package_name" and it is done.
First question: what is the difference between pip and conda?
Now I tried to install xgboost and it was really complicated I tried lot of things nothings worked until I install something called miniconda.
There it works but now, when I do "conda install package_name" it install it in miniconda3/lib/site _package and I have to copy/paste it in Anaconda3/lib/site_package if I want it to work.
Second question: how can I ask to the computer that "conda install
package_name" install it directly in anaconda3 and not miniconda3?
Finally I tried to install the package "surprise" for recommended systems. Both "pip install" or "conda install" failed.
I went in github and got the file "surprise" from https://github.com/NicolasHug/Surprise
I tried to copy it in Anaconda3/lib/site_package but it doesn't work.
When I do from surprise import Reader I did not get the error "no module name surprise" anymore but I get "cannot import name 'Reader'"
Last question: how can I make it work? I think I have to build it but
I do not now how...
Thank you in advance for anyone that can explain all this for me :-)
Similarly to you, I had issues installing the surprise package.
I tried both pip install surprise and conda install surprise unsuccessfully.
conda install -c conda-forge scikit-surprise
conda install -c conda-forge/label/gcc7 scikit-surprise
conda install -c conda-forge/label/cf201901 scikit-surprise
I found those on the anconda website and the first one worked for me.
Hopefully this would help you as well
pip vs conda
pip is a package manager that facilitates installation, upgrade,
and uninstallation of python packages. It also works with virtual python environments.
conda is a package manager for any software (installation, upgrade and uninstallation).
It also works with virtual system environments.
Conda is a packaging tool and installr that aims to do more than what pip does;
handle library dependencies outside of the Python packages as well as the Python packages themselves.
Conda also creates a virtual environment, like virtualenv does.
For more see here
Anaconda vs miniconda
The open source version of Anaconda is an easy-to-install
high performance Python and R distribution with a package manager,
environment manager and collection of 720+ open source packages.
It also comes with the options to install RStudio.
The "lite" version of Anaconda without the collection of 720 packages.
The downside is that you need to type in command line commands,
"conda install PACKAGENAME"
And Last
To install this package with conda run:
conda install -c anaconda py-xgboost=0.60
Update for surprise
The easiest way is to use pip (you'll need numpy):
$ pip install numpy
$ pip install scikit-surprise
Or you can clone the repo and build the source (you'll need Cython and numpy):
$ git clone https://github.com/NicolasHug/surprise.git
$ python setup.py install

Resources