Adding a link to a requirements.txt pip file - pip

pip install torch -f https://download.pytorch.org/whl/torch_stable.html
Hey. To fix my torch installation I have to run the above command. I was wondering if I am able to put urls in my requirements.txt?
simply putting the URL inside doesn't seem to work.
I tried the following: torch # https://download.pytorch.org/whl/torch_stable.html, but when I go to install i get
ERROR: Cannot determine archive format of C:\Users\benn\AppData\Local\Temp\pip-install-eu3abpd_\torch_ef332a557d1f4161bd846ea665b23740

Related

Pip: install --find-links on multiple folder

I create a virtual environment with the command:
python -m venv ./my_venv
After activating this virtual env, I want to install some packages with .tar.gz archives.
My method to install my packages is explained in the following part:
PACKAGE1='/path/to/the/folder1'
PACKAGE2='/path/to/the/folder2'
PACKAGE3='/path/to/the/folder3'
PACKAGE4='/path/to/the/folder4'
pip install --find-links="${PACKAGE1}" package_1==1.0.0
pip install --find-links="${PACKAGE2}" package_2==1.0.0
pip install --find-links="${PACKAGE3}" package_3==1.0.0
pip install --find-links="${PACKAGE4}" package_4==1.0.0
Now I want to use a file requirements.txt like:
package_1==1.0.0
package_2==1.0.0
package_3==1.0.0
package_4==1.0.0
and run the command:
pip install --find-links="${PACKAGE}" -r requirements.txt
but
I don't find the way to tell pip to install using multiple folder.
Here is an example of what I want:
PACKAGE1='/path/to/the/folder1'
PACKAGE2='/path/to/the/folder2'
PACKAGE3='/path/to/the/folder3'
PACKAGE4='/path/to/the/folder4'
pip install --find-links="${PACKAGE1}" --find-links="${PACKAGE2}" --find-links="${PACKAGE3}" --find-links="${PACKAGE4}" -r requirements.txt
Obviously, I didn't work.
Can you help me ? :)
Have a look at the --find-links documentation again:
If a local path ... that’s a directory, then look for archives in the directory listing.
So /path/to/the/folder4 for example will need to contain an archive/wheel for package4. This will not work if /path/to/the/folder4 is just the source directory/root for package4.

No module named pymc3

HI i'm trying to import pymc3 after pip installing it from the command line within the library where Python.exe sits in. (i.e. >>python -m pip install pymc3). after checking the Lib/Site-Packages library, there's no pymc3, but there is a theanos package installed though. i've looked everywhere for the pymc3 package but can't find it. i've tried installing pymc4 and same thing happens. any idea why?
You should be able to run pip straight for command line.
IE: the command is "pip install pymc3"
Then you would need to import it.
Your issue might also be that you recently installed python and have pip3 installed and not pip. You can check if pip vs pip3 is installed with pip --version and pip3 --version.
Whichever one of those responds with some form of pip XX.X.X from /.... would be the command you need to run.
If you do have pip3 then the command to run from the command line would be "pip3 install pymc3"
Are you able to do
import pymc3
in a Python script? If so, you can find out where it's installed with
print(pymc3.__file__)

ERROR: torch has an invalid wheel, .dist-info directory not found

I was going to install torch in virtual environment.
So I commanded !pip install torch, but there was an ERROR.
Collecting torch
Using cached torch-1.7.0-cp37-cp37m-win_amd64.whl(184.0 MB)
ERROR: torch ahs an invalid wheel, .dist-info directory not found
In How to fix ".dist-info directory not found" in my package? here, One answer said that deleting Appdata/Local/pip/Cache flder was working.
What should I do?
time has passed. But just in case someone happens to com on this post because of the same issue, you can try the following commands:
If you do not need a CUDA installation
pip install torch==1.7.0+cpu torchvision==0.8.1+cpu torchaudio===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html
If you fo need a CUDA installation
pip install torch===1.7.0 torchvision===0.8.1 torchaudio===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html
More details about the CUDA version on the official website
I deleted the Appdata/Local/pip/Cache folder in a hurry and tried it and it was installed.
Since the deleted folder is still in the Recycle Bin, I decided there would be no problem.
I have the same problem. Try to install a previous version:
pip install torch===1.6.0 torchvision===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html
I believe I somehow messed up the venv folder (I think it's about pip cache or something), so any try of pip install -r requirements.txt failed. I just deleted venv folder and recreated it with python -m venv venv
Just after that everything worked as expected and pip install -r requirements.txt installed all the packages

pip trying to install using old version of python

so I just uninstalled a wrong version of python 3.8 and downloaded python 3.7.4
Now I'm trying to install packages using the command pip install X and get the following error.
C:\Users\User>pip install cv2
Fatal error in launcher: Unable to create process using '"c:\users\user\appdata\local\programs\python\python38-32\python.exe" "C:\Users\User\AppData\Local\Programs\Python\Python38-32\Scripts\pip.exe" install cv2': The system cannot find the file specified.
clearly it is still trying to use the old version of python 3.8 even though I have uninstalled it and reinstalled pip several times.
Any idea on why its trying to look for this old path? and how can I change the default path it is using?
(btw this is just a matter of convenience because as of the moment if I use the command python -m pip install X it does seem to work)
try command python -m pip install --upgrade pip
Delete and clear environment config and install again...

pip finds package with search but won't install it

When I run pip search linkchecker I get
linkchecker - check websites and HTML documents for broken links
But when I try pip install linkchecker I get
Could not find any downloads that satisfy the requirement linkchecker
What am i doing wrong?
pip uses http://pypi.python.org/simple/<package name> to look for download links, and this package points to a kind of "non-obvious" target. pip looks for tarballs/zips in the source page, but can't find a suitable url.
Use -vvv to see how pip looks for this package:
pip install linkchecker -vvv
You may realize http://pypi.python.org/simple/linkchecker/ points to http://sourceforge.net/projects/linkchecker/files/, and there is no .tar.gz as href, only as content, and pip can't handle it.
In this case you could try this:
pip install http://sourceforge.net/projects/linkchecker/files/latest/download?source=files#egg=linkchecker -vvvv
update pip first.
pip install --upgrade pip
then, you can try install it again.
I had the same problem for installing the ultramysql package from Github.
However, trying the proposed solution of Hugo Tavares still gave the same error.
What helped in my case was adding git+ in front of the url, resulsting in the following line of code:
sudo pip install git+https://github.com/esnme/ultramysql

Resources