There are errors when I install django by git? - python

I install django through :
git clone git://github.com/django/django.git
pip install -e django/
I use Ubuntu 16.04.
But some errors occur :
Obtaining file:///home/leo/django
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/leo/django/setup.py", line 32, in <module>
version = __import__('django').get_version()
File "django/__init__.py", line 1, in <module>
from django.utils.version import get_version
File "django/utils/version.py", line 60, in <module>
#functools.lru_cache()
AttributeError: 'module' object has no attribute 'lru_cache'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /home/leo/django/
How to fix this ?
Thank you.

The last Django version does not support python 2.7.
If you really want to use python 2.7 and also use Django you should install a previous Django version.
The latest supported is: 1.11
Therefore, just run:
pip install django==1.11

This because django version you have needs python3 interpreter. so try to run the same command using pip3
To install pip3
sudo apt-get -y install python3-pip
then run
pip3 install -e django/

You can install a Python 2 version of Django using git - you just need to checkout the correct release tag first. Try something like
git clone git://github.com/django/django.git
cd django
git checkout 1.11.0
cd ..
pip install -e django/
That said, you are much better off using pip directly, as other solutions suggest.

Right > c:\Python27\Scripts>pip install django==1.11
Wrong > c:\Python27\Scripts>pip2.7 install django
c:\Python27\Scripts>pip2.7 install django
Collecting django
Using cached Django-2.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\users\shyv\appdata\local\temp\pip-build-idpp6j\django\setup.py", line 32, in <module>
version = __import__('django').get_version()
File "django\__init__.py", line 1, in <module>
from django.utils.version import get_version
File "django\utils\version.py", line 61, in <module>
#functools.lru_cache()
AttributeError: 'module' object has no attribute 'lru_cache'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in c:\users\shyv\appdata\local\temp\pip-build-idpp6j\django\
c:\Python27\Scripts>pip install django==1.11
Collecting django==1.11
c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cau
SNIMissingWarning
c:\python27\lib\site-packages\pip\_vendor\requests\packages\urllib3\util\ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL co
InsecurePlatformWarning
Downloading Django-1.11-py2.py3-none-any.whl (6.9MB)
100% |################################| 6.9MB 108kB/s
Collecting pytz (from django==1.11)
Downloading pytz-2017.3-py2.py3-none-any.whl (511kB)
100% |################################| 512kB 922kB/s
Installing collected packages: pytz, django
Successfully installed django-1.11 pytz-2017.3

Related

django-numpy gives error with pip

I've been using django-numpy for some time now. But suddenly it gives an error, when I try to install it in a django project.
I've tried different approaches installing django-numpy - made a new venv - tried with another version og both django and django-numpy.
The error I get, when doing a pip install -r requirements.txt is:
Collecting django-numpy==1.0.1 (from -r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/35/b0/1f0be2e9c4df3b0736b09067dd041eb4475a6199b583428b241eb8576d7d/django-numpy-1.0.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-4qp99vp2/django-numpy/setup.py", line 6, in <module>
from pip.download import PipSession
ModuleNotFoundError: No module named 'pip.download'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in
/tmp/pip-install-4qp99vp2/django-numpy/
I've tried installing different packages via requirements, with no problems. It's only django-numpy that gives an error?
I do not know if I should make an issue on django-numpy's github?

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

Problems with pip install django-socketio

pip3 install -U django-socketio outputs the following errors python version on this environment is 3.4.3. The same thing appears when I try to install django channels on python 3.5 or higher
Collecting django-socketio
Downloading django-socketio-0.3.9.tar.gz (48kB)
100% |████████████████████████████████| 51kB 204kB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-j3y67yvi/django-socketio/setup.py", line 7, in <module>
version = __import__("django_socketio").__version__,
File "/tmp/pip-build-j3y67yvi/django-socketio/django_socketio/__init__.py", line 2, in <module>
from django_socketio.utils import NoSocket, send, broadcast, broadcast_channel
File "/tmp/pip-build-j3y67yvi/django-socketio/django_socketio/utils.py", line 44
except IndexError, KeyError:
^
SyntaxError: invalid syntax
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-j3y67yvi/django-socketio/
I tried to install it using pip but I was unsuccessful.
What you can do is:
1) download the Source Code from GitHub to where you want the files to be
git clone https://github.com/stephenmcd/django-socketio
2) unzip it and go inside the django-socketio directory
3) run:
python3 setup.py install
you can check if it has installed by running the command:
pip3 freeze
hope this helps!

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

How to build scikit-image in travis-ci?

I am trying to build a script that makes use of scikit-image on Travis-ci. It complains that six is not up to date. Just to be sure, I tried to replicate the .travis.yml of the scikit-image project on github, but it did nothing to change the situation. I also tried to update six, but to no avail...
Does someone know how to build scikit-image on travis?
My requirements.txt:
# Requirements list:
scikit-image
My trace:
$ source ~/virtualenv/python3.3/bin/activate
$ python --version
Python 3.3.5
$ pip --version
pip 6.0.7 from /home/travis/virtualenv/python3.3.5/lib/python3.3/site-packages (python 3.3)
5.80s$ pip install -r requirements.txt
You are using pip version 6.0.7, however version 6.0.8 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting scikit-image (from -r requirements.txt (line 2))
Downloading scikit-image-0.10.1.tar.gz (16.7MB)
100% |################################| 16.7MB 20kB/s
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/tmp/pip-build-wsd_vd/scikit-image/setup.py", line 110, in <module>
check_requirements()
File "/tmp/pip-build-wsd_vd/scikit-image/setup.py", line 105, in check_requirements
% ((package_name, ) + min_version))
ImportError: You need `six` version 1.3 or later.
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/tmp/pip-build-wsd_vd/scikit-image/setup.py", line 110, in <module>
check_requirements()
File "/tmp/pip-build-wsd_vd/scikit-image/setup.py", line 105, in check_requirements
% ((package_name, ) + min_version))
ImportError: You need `six` version 1.3 or later.
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-wsd_vd/scikit-image
The command "pip install -r requirements.txt" failed and exited with 1 during .
Your build has been stopped.
If you get an error that a specific dependency isn't being met, being more specific about that dependency usually helps. I like to put dependencies that I don't directly use in a before_install section.
before_install:
pip install six>=1.3
install:
pip install -r requirements.txt
pip allows you to specify constraints on the versions of packages you install. If you had to use 1.3 exactly you could use ==.

Categories