pip install from shortened url - python

I have put my wheel file at http://long.url.name.com/package-cp27-none-linux_x86_64.whl, and when I do pip install http://long.url.name.com/package-cp27-none-linux_x86_64.whl, it works great. However, when I have a URL shortener forward the above URL and get something like http://short.url/XYZ, and try to do pip install http://short.url/XYZ, pip doesn't work. I notice the download activity, but I see the following error from pip :
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 18, in <module>
IOError: [Errno 2] No such file or directory: '/tmp/pip-2LPqrK-build/setup.py'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-2LPqrK-build
The problem seems to be that the filename that pip sees for the file is XYZ. This is true when I try to download the file using wget, for instance. However, when I got to http://short.url/XYZ, the file indeed gets downloaded and saved as package-cp27-none-linux_x86_64.whl. So how can I make pip work with the shortened URL?

So it appears that pip cares about the format of the file at the end of the url
so https://aka.ms/foo-1.0.0-py3-none-any.whl works. but if you just have a hask then

Related

Private Github python repo cannot be installed

I want to install this Python package from a private repository.
I tried multiple ways addressed here.
However, I got following errors:
1.
MakotonoMacBook-ea:~ makotomiyazaki$ pip install https://github.com/nealjean/coreg.git
Collecting https://github.com/nealjean/coreg.git
Downloading https://github.com/nealjean/coreg.git
\ 102kB 955kB/s
ERROR: Cannot unpack file /private/var/folders/_f/ds87hcrj1d3023gdtg72nb7w0000gn/T/pip-unpack-hl6ejff8/coreg.git
(downloaded from /private/var/folders/_f/ds87hcrj1d3023gdtg72nb7w0000gn/T/pip-req-build-0xy7h6hv, content-type: text/html; charset=utf-8);
cannot detect archive format
ERROR: Cannot determine archive format of /private/var/folders/_f/ds87hcrj1d3023gdtg72nb7w0000gn/T/pip-req-build-0xy7h6hv
2.
MakotonoMacBook-ea:~ makotomiyazaki$ pip install git+https://github.com/nealjean/coreg
Collecting git+https://github.com/nealjean/coreg
Cloning https://github.com/nealjean/coreg to /private/var/folders/_f/ds87hcrj1d3023gdtg72nb7w0000gn/T/pip-req-build-zvs4cg3t
Running command git clone -q https://github.com/nealjean/coreg /private/var/folders/_f/ds87hcrj1d3023gdtg72nb7w0000gn/T/pip-req-build-zvs4cg3t
ERROR: Complete output from command python setup.py egg_info:
ERROR: Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/makotomiyazaki/anaconda3/lib/python3.6/tokenize.py", line 452, in open
buffer = _builtin_open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: '/private/var/folders/_f/ds87hcrj1d3023gdtg72nb7w0000gn/T/pip-req-build-zvs4cg3t/setup.py'
----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/_f/ds87hcrj1d3023gdtg72nb7w0000gn/T/pip-req-build-zvs4cg3t/
3.
MakotonoMacBook-ea:~ makotomiyazaki$ pip install -e git+https://github.com/nealjean/coreg
ERROR: Could not detect requirement name for 'git+https://github.com/nealjean/coreg',
please specify one with #egg=your_package_name
I referred to several other methods suggested such as this, but didn't solve my problem.
Does anyone know the cause and the solutions?
I am using Python 3.6.8
The repository doesn't have setup.py, it cannot be installed with pip.

brew 0.1.4 installation for python pip error

I'm new to python and i have been trying to install brew 0.1.4. I get the following error.
C:\Users\sys>pip install brew
Collecting brew
Using cached brew-0.1.4.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\sys\AppData\Local\Temp\pip-build-m49ufx8l\brew\setup.py",line 22, in <module>
with open('requirements.txt') as fid:
FileNotFoundError: [Errno 2] No such file or directory:'requirements.txt'
Command "python setup.py egg_info" failed with error code 1 in
C:\Users\sys\AppData\Local\Temp\pip-build-m49ufx8l\brew\
I have tried the freeze method to create the requirements file but still get the same error. Help me resolve this.
$ pip freeze > requirements.txt
The requirements.txt seems to be missing in the .zip file from pypi. Try installing from the github repository instead:
pip install git+https://github.com/viisar/brew.git

Error when installing scapy

Ok so i'm trying to install scapy for python3, but ive been having some issues
when I enter this command:
pip install scapy
This is the output:
Collecting scapy
Using cached scapy-2.3.3.tgz
In the tar file C:\Users\MYNAME~1\AppData\Local\Temp\pip-oao3meyq-
unpack\scapy-2.3.3.tgz the member scapy-2.3.3/README
is invalid: unable to resolve link inside archive
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\MYNAME~1\AppData\Local\Temp\pip-build-
qjegdxw6\scapy\setup.py", line 36
os.chmod(fname, 0755)
^
SyntaxError: invalid token
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in
C:\Users\MYNAME~1\AppData\Local\Temp\pip-build-qjegdxw6\s
capy\
So then I searched around and I tried using this:
pip3 install scapy-python3
But it just says that pip3 isnt a command, so im not sure what to do
Instead of pip3 use pip
pip install scapy-python3
It worked for me. pip3 is usually used if you have both python2 and python3 installed on your machine. It is uesd to distinguish between different pips in your system.
The pip3.exe will be in python3x/scripts/.
Check if there is a pip3.exe is available in your scripts folder.
If the above solution doesn't work for you then try giving the full path of correct pip.exe.

Install failed with Django-Chronograph by pip in django 1.10

Similar to this question but i got a different error.
I'm try to installing via pip with:
pip install django-chronograph
I'm using python 2.7 and a virtualenv
pip freeze
Django==1.10
django-backbone==0.2.3
django-jstemplate==1.1.1
gunicorn==18.0
MySQL-python==1.2.5
six==1.10.0
South==0.7.6
unicodecsv==0.9.4
Error:
pip install django-chronograph
Collecting django-chronograph
Using cached django-chronograph-0.3.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/87/h3ltndc5279cknk_vn9nzjjc0000gn/T/pip-build-_JDRxl/django-chronograph/setup.py", line 32, in <module>
setup_distribute()
File "/private/var/folders/87/h3ltndc5279cknk_vn9nzjjc0000gn/T/pip-build-_JDRxl/django-chronograph/setup.py", line 18, in setup_distribute
distribute_setup = __import__('distribute_setup')
File "distribute_setup.py", line 1
<html>
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/87/h3ltndc5279cknk_vn9nzjjc0000gn/T/pip-build-_JDRxl/django-chronograph/
The problem is with the installation script provided by django-chronograph.
In line 16 of setup.py, it tries to download a script:
https://bitbucket.org/wnielson/django-chronograph/src/f561106f6aaab62f2817e08e51c799320fd916d9/setup.py?at=default&fileviewer=file-view-default#setup.py-16
in this code block:
try:
import distribute_setup
except:
# Make sure we have Distribute
if not os.path.exists('distribute_setup'):
urllib.urlretrieve('http://nightly.ziade.org/distribute_setup.py',
'./distribute_setup.py')
However, when you visit the URL at http://nightly.ziade.org/distribute_setup.py, it gives a 404 error, thus the returned html in the error.
It looks like you might be able to get distribute here: https://pypi.python.org/pypi/distribute/0.7.3
Or try doing this before you install django-chronograph:
pip install distribute
Good luck!
django-chronograph is unmaintained. Its fork is doing much better and has support for Django 2.0 and Django 2.1: https://github.com/chrisspen/django-chroniker

Twilio for Python installation errror (Win10)

I successfully added python to my PATH. I found these instructions on https://www.twilio.com/docs/python/install#installation.
I get the following error when I try to run the following command on my Command Prompt :
python setup.py install
Error :
C:\Python27>python setup.py install
Traceback (most recent call last):
File "setup.py", line 6, in <module>
with open('twilio/version.py') as f:
IOError: [Errno 2] No such file or directory: 'twilio/version.py'
I also took out the setup.py file from the twilio folder and placed it into C:\Python27 directory.
Why is this error occuring ?
It's better to install it via pip:
pip install twilio
If you must install it from source, first unpack the source code from the zip archive. Then locate the setup.py file. You need to run it in the same directory. So for example, if you unpacked twilio to D:\twilio and your setup file path is D:\twilio\setup.py, you first need to change directory to there.
cd D:\twilio\setup.py
python setup.py install
Looks like you tried to copy the setup.py file to your Python installation folder and tried to run it from there. That will not work since the setup file depends on other files in that unpacked source directory.

Categories