Trouble installing secondary dependencies on Heroku - python

Has anyone seen this before? Below are the output logs that occur when I try to push to heroku ever since adding a new dependency, pysendy.
Note that pysendy requires the module 'requests' and thus I have also added requests to my requirements.txt. If you look at the top of the logs carefully you'll see that the requests module is downloaded & unpacked during the dyno startup, but pysendy doesn't see it. I even tried putting 'requests' at the top of the requirements.txt and nothing changed. Heroku rejects the app. I can get around this by manually importing pysendy into my project because it is small, but that sort of defeats the point of having dependencies.
My suspicion is that something about the request module dependency's installation isn't complete when pysendy tries to access the requests module.
Requirements.txt:
requests==2.2.1
Django==1.6.2
dj-database-url==0.3.0
dj-static==0.0.5
django-toolbelt==0.0.1
djangorestframework==2.3.13
gunicorn==18.0
psycopg2==2.5.2
pysendy==0.0.3
pystache==0.5.3
static==1.0.2
Output Logs:
-----> Python app detected
-----> Using Python runtime (python-3.4.0)
-----> Installing dependencies using Pip (1.5.4)
Downloading/unpacking requests==2.2.1 (from -r requirements.txt (line 1))
Downloading/unpacking pysendy==0.0.3 (from -r requirements.txt (line 11))
Downloading pysendy-0.0.3.tar.gz
Running setup.py (path:/tmp/pip_build_u37993/pysendy/setup.py) egg_info for package pysendy
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip_build_u37993/pysendy/setup.py", line 5, in <module>
version = __import__('pysendy').__version__
File "/tmp/pip_build_u37993/pysendy/pysendy/__init__.py", line 2, in <module>
from .pysendy import *
File "/tmp/pip_build_u37993/pysendy/pysendy/pysendy.py", line 3, in <module>
import requests
ImportError: No module named 'requests'
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/tmp/pip_build_u37993/pysendy/setup.py", line 5, in <module>
version = __import__('pysendy').__version__
File "/tmp/pip_build_u37993/pysendy/pysendy/__init__.py", line 2, in <module>
from .pysendy import *
File "/tmp/pip_build_u37993/pysendy/pysendy/pysendy.py", line 3, in <module>
import requests
ImportError: No module named 'requests'
----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_u37993/pysendy
Storing debug log for failure in /app/.pip/pip.log
! Push rejected, failed to compile Python app

Seems like pysendy is trying to use requests during its installation, and despite having it in it's installation requirements (see https://github.com/thiagofa/pysendy/blob/master/setup.py) it's still not being installed. This is clearly an upstream bug since it reproduces on a clean virtual env.
A workaround could be to push an initial requirements.txt with pysendy commented out, let it complete, thus fully installing requests, and then push the full version again to Heroku.

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?

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

There are errors when I install django by git?

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

Installing Requirements for Heroku Server

I am currently trying to set up a Flask webserver on Heroku, following the following instructions: http://virantha.com/2013/11/14/starting-a-simple-flask-app-with-heroku/
Right now I am trying to install requirements on a virtualenv so that I can deploy the app locally. However, when I run 'pip install -r requirements.txt', I get the following error log (including just the tail):
Using cached idna-2.1-py2.py3-none-any.whl
Collecting imread==0.5.1 (from -r requirements.txt (line 24))
Using cached imread-0.5.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/c3/nwlcwspn7l16n19lhzd7xky00000gn/T/pip-build-X2ZNNp/imread/setup.py", line 19, in <module>
import numpy as np
ImportError: No module named numpy
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/c3/nwlcwspn7l16n19lhzd7xky00000gn/T/pip-build-X2ZNNp/imread/
I tried fixing the errors by following the instructions at this thread: Can't install via pip because of egg_info error
but to no avail.
I'm wondering if anyone has any insights to offer for other things I can try, as I've been stuck on this for a few hours now.
Thanks!

amazon_scraper installation issue

This is the link from where i am trying to download the scraper:
https://pypi.python.org/pypi/amazon_scraper/0.1.2
After trying the command ( pip install amazon_scraper) i get this error :
pip install amazon_scraper
Collecting amazon-scraper
Using cached amazon_scraper-0.3.1.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "c:\users\saurin\appdata\local\temp\pip-build-jxcqui\amazon-scraper\setup.py", line 4, in <module>
del os.link
AttributeError: link
[31mCommand "python setup.py egg_info" failed with error code 1 in
c:\users\saurin\appdata\local\temp\pip-build-jxcqui\amazon-scraper[0m
I tried downloading the rar file running the setup file. I am getting various issues, does any one have solution to this ?
Ensure that you have all the require dependencies installed.
python-amazon-simple-product-api
requests
beautifulsoup4
xmltodict
python-dateutil

Categories