pip install Failed in OpenShift, the error info is Permission Denied - python

when I git push and rebuild my DIY application in OpenShift, the pip install failed, and the error is Permission Denied. does any one know why ?
I have no idea why pip will write the .pip in /var/lib/openshift/513b50c74382ec1582000797/ path.
remote: Building git ref 'master', commit 35344b7
remote: Requirement already satisfied (use --upgrade to upgrade): Flask==0.9 in ./app-root/data/lib/python2.7/site-packages (from -r /var/lib/openshift/513b50c74382ec1582000797/app-root/runtime/repo//requirements.txt (line 1))
remote: Requirement already satisfied (use --upgrade to upgrade): markdown in ./app-root/data/lib/python2.7/site-packages (from -r /var/lib/openshift/513b50c74382ec1582000797/app-root/runtime/repo//requirements.txt (line 2))
remote: Requirement already satisfied (use --upgrade to upgrade): tornado==1.2.1 in ./app-root/data/lib/python2.7/site-packages (from -r /var/lib/openshift/513b50c74382ec1582000797/app-root/runtime/repo//requirements.txt (line 3))
remote: Requirement already satisfied (use --upgrade to upgrade): uWSGI==1.4.4 in ./app-root/data/lib/python2.7/site-packages (from -r /var/lib/openshift/513b50c74382ec1582000797/app-root/runtime/repo//requirements.txt (line 4))
remote: Requirement already satisfied (use --upgrade to upgrade): PyRSS2Gen in ./app-root/data/lib/python2.7/site-packages (from -r /var/lib/openshift/513b50c74382ec1582000797/app-root/runtime/repo//requirements.txt (line 5))
remote: Requirement already satisfied (use --upgrade to upgrade): pygments in ./app-root/data/lib/python2.7/site-packages (from -r /var/lib/openshift/513b50c74382ec1582000797/app-root/runtime/repo//requirements.txt (line 6))
remote: Downloading/unpacking Flask-Cache==0.13 (from -r /var/lib/openshift/513b50c74382ec1582000797/app-root/runtime/repo//requirements.txt (line 7))
remote: Exception:
remote: Traceback (most recent call last):
remote: File "/var/lib/openshift/513b50c74382ec1582000797/app-root/data/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/basecommand.py", line 104, in main
remote: status = self.run(options, args)
remote: File "/var/lib/openshift/513b50c74382ec1582000797/app-root/data/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/commands/install.py", line 245, in run
remote: requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
remote: File "/var/lib/openshift/513b50c74382ec1582000797/app-root/data/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/req.py", line 971, in prepare_files
remote: location = req_to_install.build_location(self.build_dir, not self.is_download)
remote: File "/var/lib/openshift/513b50c74382ec1582000797/app-root/data/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/req.py", line 153, in build_locatio
remote: _make_build_dir(build_dir)
remote: File "/var/lib/openshift/513b50c74382ec1582000797/app-root/data/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/req.py", line 1225, in _make_build_dir
remote: os.makedirs(build_dir)
remote: File "/var/lib/openshift/513b50c74382ec1582000797/app-root/data/lib/python2.7/os.py", line 157, in makedirs
remote: mkdir(name, mode)
remote: OSError: [Errno 13] Permission denied: '/var/lib/openshift/513b50c74382ec1582000797/build'
remote:
remote: Storing complete log in /var/lib/openshift/513b50c74382ec1582000797/.pip/pip.log
remote: Traceback (most recent call last):
remote: File "/var/lib/openshift/513b50c74382ec1582000797/app-root/data//bin/pip", line 8, in <module>
remote: load_entry_point('pip==1.1', 'console_scripts', 'pip')()
remote: File "/var/lib/openshift/513b50c74382ec1582000797/app-root/data/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/__init__.py", line 116, in main
remote: return command.main(args[1:], options)
remote: File "/var/lib/openshift/513b50c74382ec1582000797/app-root/data/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/basecommand.py", line 141, in main
remote: log_fp = open_logfile(log_fn, 'w')
remote: File "/var/lib/openshift/513b50c74382ec1582000797/app-root/data/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/basecommand.py", line 165, in open_logfile
remote: os.makedirs(dirname)
remote: File "/var/lib/openshift/513b50c74382ec1582000797/app-root/data/lib/python2.7/os.py", line 157, in makedirs
remote: mkdir(name, mode)
remote: OSError: [Errno 13] Permission denied: '/var/lib/openshift/513b50c74382ec1582000797/.pip'
remote: An error occurred executing 'gear postreceive' (exit code: 1)
remote: Error message: CLIENT_ERROR: Failed to execute action hook 'build' for 513b50c74382ec1582000797 application py27
remote:
remote: For more details about the problem, try running the command again with the '--trace' option.

looks like pip install by default tries to write some information into your home directory, which you don't have access to write to on openshift. Have you tried using one of the pre-built python cartridges? They are setup to correctly install packages that you define within your application.
If you are dead set on using a DIY gear, you might at least look at the code for the default python cartridges and see how they solve this same issue: https://github.com/openshift/origin-server/tree/master/cartridges

Related

heroku pip requirements.txt google-cloud-speech fails

I have a requirements.txt in my python/django project. Everything has worked fine, locally as well, until I tried to include google-cloud-speech in my requirements and deploying to heroku. It has failed since then and I'm not sure why. (I have deployed to heroku numerous times before this)
I'm following this example here: https://cloud.google.com/speech-to-text/docs/libraries
Test locally, everything compiles and endpoints work correctly with the imports of:
from google.cloud import speech_v1p1beta1
from google.cloud.speech_v1p1beta1 import enums
Steps to reproduce:
In my virtualenv
pip install -r requirements.txt
python manage.py runserver [works]
run endpoint for speech transcription [works]
git push heroku master [fails]
Here's the output:
remote: $ pip install -r requirements.txt
remote: Collecting google-cloud-speech==1.3.2 (from -r requirements.txt (line 25))
remote: Downloading https://files.pythonhosted.org/packages/5c/4b/76ec278f9ac5b6a525d222d7539cc473cca41f639a571177301a5115d0b3/google_cloud_speech-1.3.2-py2.py3-none-any.whl (88kB)
remote: Collecting setuptools==49.2.0 (from -r requirements.txt (line 50))
remote: Downloading https://files.pythonhosted.org/packages/8e/11/9e10f1cad4518cb307b484c255cae61e97f05b82f6d536932b1714e01b47/setuptools-49.2.0-py3-none-any.whl (789kB)
remote: Collecting pip>=9.0.1 (from pipenv==2018.11.26->-r requirements.txt (line 36))
remote: Downloading https://files.pythonhosted.org/packages/43/84/23ed6a1796480a6f1a2d38f2802901d078266bda38388954d01d3f2e821d/pip-20.1.1-py2.py3-none-any.whl (1.5MB)
remote: Collecting grpcio<2.0dev,>=1.29.0 (from google-api-core[grpc]<2.0.0dev,>=1.14.0->google-cloud-speech==1.3.2->-r requirements.txt (line 25))
remote: Downloading https://files.pythonhosted.org/packages/5e/29/1bd649737e427a6bb850174293b4f2b72ab80dd49462142db9b81e1e5c7b/grpcio-1.30.0.tar.gz (19.7MB)
remote: Exception:
remote: Traceback (most recent call last):
remote: File "/app/.heroku/python/lib/python3.6/site-packages/pip-8.1.1-py3.6.egg/pip/_vendor/pkg_resources/__init__.py", line 2610, in _dep_map
remote: return self.__dep_map
remote: File "/app/.heroku/python/lib/python3.6/site-packages/pip-8.1.1-py3.6.egg/pip/_vendor/pkg_resources/__init__.py", line 2685, in __getattr__
remote: raise AttributeError(attr)
remote: AttributeError: _Distribution__dep_map
remote:
remote: During handling of the above exception, another exception occurred:
remote:
remote: Traceback (most recent call last):
remote: File "/app/.heroku/python/lib/python3.6/site-packages/pip-8.1.1-py3.6.egg/pip/basecommand.py", line 209, in main
remote: status = self.run(options, args)
remote: File "/app/.heroku/python/lib/python3.6/site-packages/pip-8.1.1-py3.6.egg/pip/commands/install.py", line 299, in run
remote: requirement_set.prepare_files(finder)
remote: File "/app/.heroku/python/lib/python3.6/site-packages/pip-8.1.1-py3.6.egg/pip/req/req_set.py", line 360, in prepare_files
remote: ignore_dependencies=self.ignore_dependencies))
remote: File "/app/.heroku/python/lib/python3.6/site-packages/pip-8.1.1-py3.6.egg/pip/req/req_set.py", line 647, in _prepare_file
remote: set(req_to_install.extras) - set(dist.extras)
remote: File "/app/.heroku/python/lib/python3.6/site-packages/pip-8.1.1-py3.6.egg/pip/_vendor/pkg_resources/__init__.py", line 2810, in extras
remote: return [dep for dep in self._dep_map if dep]
remote: File "/app/.heroku/python/lib/python3.6/site-packages/pip-8.1.1-py3.6.egg/pip/_vendor/pkg_resources/__init__.py", line 2624, in _dep_map
remote: dm.setdefault(extra,[]).extend(parse_requirements(reqs))
remote: File "/app/.heroku/python/lib/python3.6/site-packages/pip-8.1.1-py3.6.egg/pip/_vendor/pkg_resources/__init__.py", line 2980, in parse_requirements
remote: "version spec")
remote: File "/app/.heroku/python/lib/python3.6/site-packages/pip-8.1.1-py3.6.egg/pip/_vendor/pkg_resources/__init__.py", line 2956, in scan_list
remote: raise RequirementParseError(msg, line, "at", line[p:])
remote: pip._vendor.pkg_resources.RequirementParseError: Expected ',' or end-of-list in futures>=2.2.0; python_version<'3.2' at ; python_version<'3.2'
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
Here's my requirements.txt
apns2==0.7.1
asn1crypto==1.1.0
boto3==1.9.250
botocore==1.12.251
certifi==2019.9.11
cffi==1.13.0
celery==4.4.1
chardet==3.0.4
cryptography==2.9
Django==2.2.4
django-bootstrap4==0.0.8
django-cors-headers==3.2.0
django-extensions==2.2.9
django-filter==2.2.0
django-heroku==0.3.1
django-rest-framework-social-oauth2==1.1.0
django-storages==1.7.1
djangorestframework==3.10.3
dj-database-url==0.5.0
dj-stripe==2.3.0
docutils==0.15.2
gunicorn==20.0.4
gcloud==0.18.3
google-cloud-storage==1.29.0
google-cloud-speech==1.3.2
google-api-python-client==1.10.0
h2==2.6.2
hpack==3.0.0
hyper==0.7.0
hyperframe==3.2.0
idna==2.8
jmespath==0.9.4
nltk==3.5
pandas==1.0.3
Pillow==7.1.2
pipenv==2018.11.26
psycopg2-binary
pycparser==2.19
pydub==0.24.1
PyJWT==1.7.1
python-dateutil==2.8.0
pytest==5.4.1
pytest-django==3.8.0
pytz==2019.2
redis==3.4.1
requests==2.22.0
rest-social-auth==2.0.2
s3transfer==0.2.1
sendgrid==6.3.1
six==1.12.0
stripe==2.48.0
sqlparse==0.3.0
urllib3==1.24.3
virtualenv==16.7.6
virtualenv-clone==0.5.3
I ended up having to downgrade my versions of grpcio and google-core-api to resolve this. Lots of trial and error so I don't really have a root cause to share unfortunately.

Python Django heroku error "! [remote rejected] master -> master (pre-receive hook declined)"

Whenever I type command: git push heroku master
Enumerating objects: 32, done.
Counting objects: 100% (32/32), done.
Delta compression using up to 4 threads
Compressing objects: 100% (30/30), done.
Writing objects: 100% (32/32), 11.43 KiB | 557.00 KiB/s, done.
Total 32 (delta 2), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: -----> Installing python-3.6.7
remote: -----> Installing pip
remote: -----> Installing SQLite3
remote: -----> Installing requirements with pip
remote: Collecting dj-database-url==0.5.0 (from -r /tmp/build_731c5da72f871fc9827c03c3e6dfa9eb/requirements.txt (line 1))
remote: Downloading https://files.pythonhosted.org/packages/d4/a6/4b8578c1848690d0c307c7c0596af2077536c9ef2a04d42b00fabaa7e49d/dj_database_url-0.5.0-py2.py3-none-any.whl
remote: Collecting Django==2.1.3 (from -r /tmp/build_731c5da72f871fc9827c03c3e6dfa9eb/requirements.txt (line 2))
remote: Downloading https://files.pythonhosted.org/packages/d1/e5/2676be45ea49cfd09a663f289376b3888accd57ff06c953297bfdee1fb08/Django-2.1.3-py3-none-any.whl (7.3MB)
remote: Collecting django-heroku==0.3.1 (from -r /tmp/build_731c5da72f871fc9827c03c3e6dfa9eb/requirements.txt (line 3))
remote: Downloading https://files.pythonhosted.org/packages/59/af/5475a876c5addd5a3494db47d9f7be93cc14d3a7603542b194572791b6c6/django_heroku-0.3.1-py2.py3-none-any.whl
remote: Collecting gunicorn==19.9.0 (from -r /tmp/build_731c5da72f871fc9827c03c3e6dfa9eb/requirements.txt (line 4))
remote: Downloading https://files.pythonhosted.org/packages/8c/da/b8dd8deb741bff556db53902d4706774c8e1e67265f69528c14c003644e6/gunicorn-19.9.0-py2.py3-none-any.whl (112kB)
remote: Collecting psycopg2==2.7.6.1 (from -r /tmp/build_731c5da72f871fc9827c03c3e6dfa9eb/requirements.txt (line 5))
remote: Downloading https://files.pythonhosted.org/packages/bc/2a/61a8f9719bd6df5b421abd91740cb0595fc3c17b28eaf89fe4f144472ca6/psycopg2-2.7.6.1-cp36-cp36m-manylinux1_x86_64.whl (2.7MB)
remote: Collecting pytz==2018.7 (from -r /tmp/build_731c5da72f871fc9827c03c3e6dfa9eb/requirements.txt (line 6))
remote: Downloading https://files.pythonhosted.org/packages/f8/0e/2365ddc010afb3d79147f1dd544e5ee24bf4ece58ab99b16fbb465ce6dc0/pytz-2018.7-py2.py3-none-any.whl (506kB)
remote: Collecting whitenoise==4.1.2 (from -r /tmp/build_731c5da72f871fc9827c03c3e6dfa9eb/requirements.txt (line 7))
remote: Downloading https://files.pythonhosted.org/packages/fd/2a/b51377ab9826f0551da19951257d2434f46329cd6cfdf9592ea9ca5f6034/whitenoise-4.1.2-py2.py3-none-any.whl
remote: Installing collected packages: dj-database-url, pytz, Django, whitenoise, psycopg2, django-heroku, gunicorn
remote: Successfully installed Django-2.1.3 dj-database-url-0.5.0 django-heroku-0.3.1 gunicorn-19.9.0 psycopg2-2.7.6.1 pytz-2018.7 whitenoise-4.1.2
it give error here
remote:
remote: -----> $ python manage.py collectstatic --noinput
remote: Traceback (most recent call last):
remote: File "manage.py", line 15, in <module>
remote: execute_from_command_line(sys.argv)
remote: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
remote: utility.execute()
remote: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
remote: self.fetch_command(subcommand).run_from_argv(self.argv)
remote: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/base.py", line 316, in run_from_argv
remote: self.execute(*args, **cmd_options)
remote: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/base.py", line 353, in execute
remote: output = self.handle(*args, **options)
remote: File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 188, in handle
remote: collected = self.collect()
remote: File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 114, in collect
remote: handler(path, prefixed_path, storage)
remote: File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 343, in copy_file
remote: if not self.delete_file(path, prefixed_path, source_storage):
remote: File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 249, in delete_file
remote: if self.storage.exists(prefixed_path):
remote: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/files/storage.py", line 308, in exists
remote: return os.path.exists(self.path(name))
remote: File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/staticfiles/storage.py", line 43, in path
remote: raise ImproperlyConfigured("You're using the staticfiles app "
remote: django.core.exceptions.ImproperlyConfigured: You're using the staticfiles app without having set the STATIC_ROOT setting to a filesystem path.
remote:
remote: ! Error while running '$ python manage.py collectstatic --noinput'.
remote: See traceback above for details.
remote:
remote: You may need to update application code to resolve this error.
remote: Or, you can disable collectstatic for this application:
remote:
remote: $ heroku config:set DISABLE_COLLECTSTATIC=1
remote:
remote: https://devcenter.heroku.com/articles/django-assets
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to arshergon.
remote:
To https://git.heroku.com/arshergon.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/arshergon.git'
python version : 3.6.7
django version : 2.1.3
heroku version : 0.1.4
git version : 2.20.1.windows.1
machine : window 10
I have no staticfiles it is a simple Hello, World app
the command I type:
git init
git --all
git commit -m "first commit"
git: remote -a websitename
git push heroku master
try this
heroku config:set DISABLE_COLLECTSTATIC=1
Before: When error's happening
remote: File "/app/.heroku/python/lib/python3.6/site-packages/django/contrib/staticfiles/utils.py", line 23, in get_files
remote: directories, files = storage.listdir(location)
remote: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/files/storage.py", line 316, in listdir
remote: for entry in os.scandir(path):
remote: FileNotFoundError: [Errno 2] No such file or directory: '/tmp/build_fff79b97/static'
As we can observe, the traceback states
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/build_fff79b97/static'.
This is because I had my static file # root/home/static, while my STATICFILES_DIR is not pointing to that dir. So only thing I did is
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "home", "static"),
]
instead of usual os.path.join(BASE_DIR, "static").
And if you're just trying without any static files, you can directly use heroku config:set DISABLE_COLLECTSTATIC=1 and then push.
Even though you don't have static files, a Django Hello World app does mention them.
Do check if you can declare STATIC_ROOT your settings.py:
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
(as it is done in here)

ModuleNotFoundError: No module named 'Xlib' when push python app to heroku

I want to deploy a python app on Heroku, i have tried pip install python3_xlib and pip install --upgrade setuptools, but still, I can't fix the error:
(ll_env) C:\Users\lyj\Desktop\Python_journey_code\learning_log>git push heroku master
Counting objects: 49, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (41/41), done.
Writing objects: 100% (49/49), 11.77 KiB | 388.00 KiB/s, done.
Total 49 (delta 3), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: ! The latest version of Python 3.6 is python-3.6.6 (you are using python-3.6.5, which is unsupported).
remote: ! We recommend upgrading by specifying the latest version (python-3.6.6).
remote: Learn More: https://devcenter.heroku.com/articles/python-runtimes
remote: -----> Installing python-3.6.5
remote: -----> Installing pip
remote: -----> Installing SQLite3
remote: -----> Installing requirements with pip
remote: Collecting bottle==0.12.13 (from -r /tmp/build_2e656ec2526454070c23e68222daf29e/requirements.txt (line 1))
remote: Downloading https://files.pythonhosted.org/packages/bd/99/04dc59ced52a8261ee0f965a8968717a255ea84a36013e527944dbf3468c/bottle-0.12.13.tar.gz (70kB)
remote: Collecting certifi==2018.4.16 (from -r /tmp/build_2e656ec2526454070c23e68222daf29e/requirements.txt (line 2))
remote: Downloading https://files.pythonhosted.org/packages/7c/e6/92ad559b7192d846975fc916b65f667c7b8c3a32bea7372340bfe9a15fa5/certifi-2018.4.16-py2.py3-none-any.whl (150kB)
remote: Collecting chardet==3.0.4 (from -r /tmp/build_2e656ec2526454070c23e68222daf29e/requirements.txt (line 3))
remote: Downloading https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl (133kB)
remote: Collecting cycler==0.10.0 (from -r /tmp/build_2e656ec2526454070c23e68222daf29e/requirements.txt (line 4))
.......
remote: Collecting matplotlib==2.2.2 (from -r /tmp/build_2e656ec2526454070c23e68222daf29e/requirements.txt (line 11))
remote: Downloading https://files.pythonhosted.org/packages/49/b8/89dbd27f2fb171ce753bb56220d4d4f6dbc5fe32b95d8edc4415782ef07f/matplotlib-2.2.2-cp36-cp36m-manylinux1_x86_64.whl (12.6MB)
remote: Collecting numpy==1.14.2 (from -r /tmp/build_2e656ec2526454070c23e68222daf29e/requirements.txt (line 12))
remote: Downloading https://files.pythonhosted.org/packages/6e/dc/92c0f670e7b986829fc92c4c0208edb9d72908149da38ecda50d816ea057/numpy-1.14.2-cp36-cp36m-manylinux1_x86_64.whl (12.2MB)
remote: Collecting Pillow==5.1.0 (from -r /tmp/build_2e656ec2526454070c23e68222daf29e/requirements.txt (line 13))
remote: Downloading https://files.pythonhosted.org/packages/5f/4b/8b54ab9d37b93998c81b364557dff9f61972c0f650efa0ceaf470b392740/Pillow-5.1.0-cp36-cp36m-manylinux1_x86_64.whl (2.0MB)
remote: Collecting PyAutoGUI==0.9.36 (from -r /tmp/build_2e656ec2526454070c23e68222daf29e/requirements.txt (line 14))
remote: Downloading https://files.pythonhosted.org/packages/2e/83/89b5adbc37d1bbf7b486a2c1c00e8037e6f801e8c053c4897bb82d9510c6/PyAutoGUI-0.9.36.tar.gz (46kB)
remote: Complete output from command python setup.py egg_info:
remote: Traceback (most recent call last):
remote: File "<string>", line 1, in <module>
remote: File "/tmp/pip-build-dljfbbwj/PyAutoGUI/setup.py", line 6, in <module>
remote: version=__import__('pyautogui').__version__,
remote: File "/tmp/pip-build-dljfbbwj/PyAutoGUI/pyautogui/__init__.py", line 115, in <module>
remote: from . import _pyautogui_x11 as platformModule
remote: File "/tmp/pip-build-dljfbbwj/PyAutoGUI/pyautogui/_pyautogui_x11.py", line 7, in <module>
remote: from Xlib.display import Display
remote: ModuleNotFoundError: No module named 'Xlib'
remote:
remote: ----------------------------------------
remote: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-dljfbbwj/PyAutoGUI/
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to shielded-basin-12135.
remote:
To https://git.heroku.com/shielded-basin-12135.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/shielded-basin-12135.git'
For python3 try -
pip install python3-xlib

Heroku build fails always - Says no module named six

Counting objects: 1260, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (1208/1208), done.
Writing objects: 100% (1260/1260), 6.24 MiB | 184.00 KiB/s, done.
Total 1260 (delta 109), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: -----> Installing python-2.7.13
remote: -----> Installing pip
remote: -----> Installing requirements with pip
remote: Collecting appdirs==1.4.3 (from -r /tmp/build_05ed4039dfcb7243b9f260b604feea9c/requirements.txt (line 1))
remote: Downloading appdirs-1.4.3-py2.py3-none-any.whl
remote: Collecting click==6.7 (from -r /tmp/build_05ed4039dfcb7243b9f260b604feea9c/requirements.txt (line 2))
remote: Downloading click-6.7-py2.py3-none-any.whl (71kB)
remote: Collecting Flask==0.12.2 (from -r /tmp/build_05ed4039dfcb7243b9f260b604feea9c/requirements.txt (line 3))
remote: Downloading Flask-0.12.2-py2.py3-none-any.whl (83kB)
remote: Collecting gunicorn==19.7.1 (from -r /tmp/build_05ed4039dfcb7243b9f260b604feea9c/requirements.txt (line 4))
remote: Downloading gunicorn-19.7.1-py2.py3-none-any.whl (111kB)
remote: Collecting itsdangerous==0.24 (from -r /tmp/build_05ed4039dfcb7243b9f260b604feea9c/requirements.txt (line 5))
remote: Downloading itsdangerous-0.24.tar.gz (46kB)
remote: Collecting Jinja2==2.9.6 (from -r /tmp/build_05ed4039dfcb7243b9f260b604feea9c/requirements.txt (line 6))
remote: Downloading Jinja2-2.9.6-py2.py3-none-any.whl (340kB)
remote: Collecting MarkupSafe==1.0 (from -r /tmp/build_05ed4039dfcb7243b9f260b604feea9c/requirements.txt (line 7))
remote: Downloading MarkupSafe-1.0.tar.gz
remote: Collecting packaging==16.8 (from -r /tmp/build_05ed4039dfcb7243b9f260b604feea9c/requirements.txt (line 8))
remote: Downloading packaging-16.8-py2.py3-none-any.whl
remote: Collecting pyparsing==2.2.0 (from -r /tmp/build_05ed4039dfcb7243b9f260b604feea9c/requirements.txt (line 9))
remote: Downloading pyparsing-2.2.0-py2.py3-none-any.whl (56kB)
remote: Collecting six==1.10.0 (from -r /tmp/build_05ed4039dfcb7243b9f260b604feea9c/requirements.txt (line 10))
remote: Downloading six-1.10.0-py2.py3-none-any.whl
remote: Collecting Werkzeug==0.12.2 (from -r /tmp/build_05ed4039dfcb7243b9f260b604feea9c/requirements.txt (line 11))
remote: Downloading Werkzeug-0.12.2-py2.py3-none-any.whl (312kB)
remote: Installing collected packages: appdirs, click, itsdangerous, Werkzeug, MarkupSafe, Jinja2, Flask, gunicorn, pyparsing, six, packaging
remote: Running setup.py install for itsdangerous: started
remote: Running setup.py install for itsdangerous: finished with status 'error'
remote: Complete output from command /app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-H6YgNg/itsdangerous/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-VAC6vv-record/install-record.txt --single-version-externally-managed --compile:
remote: running install
remote: running build
remote: running build_py
remote: creating build
remote: creating build/lib
remote: copying itsdangerous.py -> build/lib
remote: running install_lib
remote: copying build/lib/itsdangerous.py -> /app/.heroku/python/lib/python2.7/site-packages
remote: byte-compiling /app/.heroku/python/lib/python2.7/site-packages/itsdangerous.py to itsdangerous.pyc
remote: running install_egg_info
remote: running egg_info
remote: writing itsdangerous.egg-info/PKG-INFO
remote: writing top-level names to itsdangerous.egg-info/top_level.txt
remote: writing dependency_links to itsdangerous.egg-info/dependency_links.txt
remote: reading manifest file 'itsdangerous.egg-info/SOURCES.txt'
remote: reading manifest template 'MANIFEST.in'
remote: writing manifest file 'itsdangerous.egg-info/SOURCES.txt'
remote: Copying itsdangerous.egg-info to /app/.heroku/python/lib/python2.7/site-packages/itsdangerous-0.24-py2.7.egg-info
remote: running install_scripts
remote: Traceback (most recent call last):
remote: File "<string>", line 1, in <module>
remote: File "/tmp/pip-build-H6YgNg/itsdangerous/setup.py", line 20, in <module>
remote: 'Programming Language :: Python :: 3',
remote: File "/app/.heroku/python/lib/python2.7/distutils/core.py", line 151, in setup
remote: dist.run_commands()
remote: File "/app/.heroku/python/lib/python2.7/distutils/dist.py", line 953, in run_commands
remote: self.run_command(cmd)
remote: File "/app/.heroku/python/lib/python2.7/distutils/dist.py", line 972, in run_command
remote: cmd_obj.run()
remote: File "/app/.heroku/python/lib/python2.7/site-packages/setuptools/command/install.py", line 61, in run
remote: return orig.install.run(self)
remote: File "/app/.heroku/python/lib/python2.7/distutils/command/install.py", line 575, in run
remote: self.run_command(cmd_name)
remote: File "/app/.heroku/python/lib/python2.7/distutils/cmd.py", line 326, in run_command
remote: self.distribution.run_command(command)
remote: File "/app/.heroku/python/lib/python2.7/distutils/dist.py", line 972, in run_command
remote: cmd_obj.run()
remote: File "/app/.heroku/python/lib/python2.7/site-packages/setuptools/command/install_scripts.py", line 17, in run
remote: import setuptools.command.easy_install as ei
remote: File "/app/.heroku/python/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 49, in <module>
remote: from setuptools.py27compat import rmtree_safe
remote: File "/app/.heroku/python/lib/python2.7/site-packages/setuptools/py27compat.py", line 7, in <module>
remote: import six
remote: ImportError: No module named six
remote:
remote: ----------------------------------------
remote: Command "/app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-H6YgNg/itsdangerous/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-VAC6vv-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-H6YgNg/itsdangerous/
remote: ! Push rejected, failed to compile Python app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to searchword.
remote:
To https://git.heroku.com/searchword.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/searchword.git'
I don't know what is happening. Few days ago, I was able to deploy apps on heroku with no such error. I am running on virtual environment. I activated it before pushing to heroku master. I even checked which pip I am referring to but all in vain. I have installed module 'six' on my local machine and on virtual environment even. Still always it says No module named six and fails my deploy. Please help!! Its frustrating!
Because it is google translation, I'm sorry if it turned funny.
I was addicted in exactly the same situation.
I do not know why it went well, but I replaced it to describe
"six == 1.10.0" at the beginning of "requirements.txt" and deployed it.
by the way, but my version of python is 3.6・・・
This is an issue currently with the latest release of setuptools (36.0.0). You can track the issue here - https://github.com/pypa/setuptools/issues/1042
I solved this issue by removing the module needing six from the reqirements.txt. Then push to heroku and the build was succesful. Next I added the package which needed six and it worked.

Trying to deploy to heroku but keep getting rejected

I'm trying to deploy on heroku, which is seeming to be the most complicated I've dealt with since programming. I'm getting an error that I don't have a Procfile and I do. It's only named Procfile. Not ProcFile or Procfile.txt. After I run
git push heroku master
I get the following error
Counting objects: 8524, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (7522/7522), done.
Writing objects: 100% (8524/8524), 14.00 MiB | 2.67 MiB/s, done.
Total 8524 (delta 2214), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote: ! Warning: Your application is missing a Procfile. This file tells Heroku how to run your application.
remote: ! Learn more: https://devcenter.heroku.com/articles/procfile
remote: -----> Installing python-2.7.11
remote: $ pip install -r requirements.txt
remote: Collecting beautifulsoup4==4.4.1 (from -r requirements.txt (line 1))
remote: Downloading beautifulsoup4-4.4.1-py2-none-any.whl (81kB)
remote: Collecting dj-database-url==0.4.0 (from -r requirements.txt (line 2))
remote: Downloading dj-database-url-0.4.0.tar.gz
remote: Collecting dj-static==0.0.6 (from -r requirements.txt (line 3))
remote: Downloading dj-static-0.0.6.tar.gz
remote: Collecting Django==1.9.4 (from -r requirements.txt (line 4))
remote: Downloading Django-1.9.4-py2.py3-none-any.whl (6.6MB)
remote: Collecting django-crispy-forms==1.6.0 (from -r requirements.txt (line 5))
remote: Downloading django_crispy_forms-1.6.0-py2-none-any.whl (178kB)
remote: Collecting django-haystack==2.4.1 (from -r requirements.txt (line 6))
remote: Downloading django_haystack-2.4.1-py2-none-any.whl (95kB)
remote: Collecting django-taggit==0.18.0 (from -r requirements.txt (line 7))
remote: Downloading django_taggit-0.18.0-py2.py3-none-any.whl
remote: Collecting django-toolbelt==0.0.1 (from -r requirements.txt (line 8))
remote: Downloading django-toolbelt-0.0.1.tar.gz
remote: Collecting gunicorn==19.4.5 (from -r requirements.txt (line 9))
remote: Downloading gunicorn-19.4.5-py2.py3-none-any.whl (112kB)
remote: Collecting Pillow==3.1.1 (from -r requirements.txt (line 10))
remote: Downloading Pillow-3.1.1.tar.gz (10.1MB)
remote: Collecting psycopg2==2.6.1 (from -r requirements.txt (line 11))
remote: Downloading psycopg2-2.6.1.tar.gz (371kB)
remote: Collecting pysolr==3.4.0 (from -r requirements.txt (line 12))
remote: Downloading pysolr-3.4.0-py2.py3-none-any.whl
remote: Collecting pytz==2016.1 (from -r requirements.txt (line 13))
remote: Downloading pytz-2016.1-py2.py3-none-any.whl (476kB)
remote: Collecting requests==2.9.1 (from -r requirements.txt (line 14))
remote: Downloading requests-2.9.1-py2.py3-none-any.whl (501kB)
remote: Collecting static3==0.6.1 (from -r requirements.txt (line 15))
remote: Downloading static3-0.6.1.tar.gz
remote: Collecting whitenoise==3.0 (from -r requirements.txt (line 16))
remote: Downloading whitenoise-3.0-py2.py3-none-any.whl
remote: Installing collected packages: beautifulsoup4, dj-database-url, static3, dj-static, Django, django-crispy-forms, django-haystack, django-taggit, psycopg2, gunicorn, django-toolbelt, Pillow, requests, pysolr, pytz, whitenoise
remote: Running setup.py install for dj-database-url: started
remote: Running setup.py install for dj-database-url: finished with status 'done'
remote: Running setup.py install for static3: started
remote: Running setup.py install for static3: finished with status 'done'
remote: Running setup.py install for dj-static: started
remote: Running setup.py install for dj-static: finished with status 'done'
remote: Running setup.py install for psycopg2: started
remote: Running setup.py install for psycopg2: finished with status 'done'
remote: Running setup.py install for django-toolbelt: started
remote: Running setup.py install for django-toolbelt: finished with status 'done'
remote: Running setup.py install for Pillow: started
remote: Running setup.py install for Pillow: finished with status 'done'
remote: Successfully installed Django-1.9.4 Pillow-3.1.1 beautifulsoup4-4.4.1 dj-database-url-0.4.0 dj-static-0.0.6 django-crispy-forms-1.6.0 django-haystack-2.4.1 django-taggit-0.18.0 django-toolbelt-0.0.1 gunicorn-19.4.5 psycopg2-2.6.1 pysolr-3.4.0 pytz-2016.1 requests-2.9.1 static3-0.6.1 whitenoise-3.0
remote:
remote: $ python mysite/manage.py collectstatic --noinput
remote: Traceback (most recent call last):
remote: File "mysite/manage.py", line 10, in <module>
remote: execute_from_command_line(sys.argv)
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
remote: utility.execute()
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 345, in execute
remote: self.fetch_command(subcommand).run_from_argv(self.argv)
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/base.py", line 348, in run_from_argv
remote: self.execute(*args, **cmd_options)
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/base.py", line 399, in execute
remote: output = self.handle(*args, **options)
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 176, in handle
remote: collected = self.collect()
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 98, in collect
remote: for path, storage in finder.list(self.ignore_patterns):
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/finders.py", line 112, in list
remote: for path in utils.get_files(storage, ignore_patterns):
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/staticfiles/utils.py", line 28, in get_files
remote: directories, files = storage.listdir(location)
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/core/files/storage.py", line 299, in listdir
remote: for entry in os.listdir(path):
remote: OSError: [Errno 2] No such file or directory: '/app/mysite/mysite/static'
remote:
remote: ! Error while running '$ python mysite/manage.py collectstatic --noinput'.
remote: See traceback above for details.
remote:
remote: You may need to update application code to resolve this error.
remote: Or, you can disable collectstatic for this application:
remote:
remote: $ heroku config:set DISABLE_COLLECTSTATIC=1
remote:
remote: https://devcenter.heroku.com/articles/django-assets
remote:
remote: ! Push rejected, failed to compile Python app
remote:
remote: Verifying deploy...
remote:
remote: ! Push rejected to alt-vera.
I don't know what the issue is. I've googled and none of the solutions seem to work. Also, Locally i'm using python 3.5 But In the error message I am seeing
Installing python-2.7.11 Why is that. Could this be part of the error
EDIT this is my Procfile
web: gunicorn mysite.wsgi:application --log-file -
EDIT: It worked after me doing the same thing over and over
But now I'm getting a different error message
OSError: [Errno 2] No such file or directory: '/app/mysite/mysite/static'
remote:
remote: ! Error while running '$ python mysite/manage.py collectstatic --noinput'.
remote: See traceback above for details.
remote:
remote: You may need to update application code to resolve this error.
remote: Or, you can disable collectstatic for this application:
remote:
remote: $ heroku config:set DISABLE_COLLECTSTATIC=1
remote:
remote: https://devcenter.heroku.com/articles/django-assets
remote:
remote: ! Push rejected, failed to compile Python app
remote:
remote: Verifying deploy....
remote:
remote: ! Push rejected to alt-vera.
remote:
To https://git.heroku.com/alt-vera.git
your application is missing the procfile add it and then try.
for help https://devcenter.heroku.com/articles/procfile
example for Procfile
web:python manage.py runserver
web: gunicorn your-app-name.wsgi --log-file -
heroku ps:scale web=1
Coming to this rather late, so not sure if this will be helpful. I found your question because I was having the same problem: I used the Heroku-supplied Django template and definitely had a Procfile in the root of the project.
Which folder did you do $ git init in?
My mistake was that I had created a folder ('WEB_CODE') on my desktop to hold this project and initialized THIS folder as a git repo. This meant that the Django app was being installed in a sub-folder at WEB_CODE/myapp, so the Procfile was at the root of myapp, which was not the head of the git repo.
I scrapped this and started over. I now have a new folder to hold everything (suppose it's called 'APP_CODE'), and once I installed the Heroku-supplied Django app, I made the subdirectory which was created from this installation the head of the git repo (eg: APP_CODE/myapp is the repo, not APP_CODE). Consequently, the Procfile was then in the root of the project.
I committed the changes, pushed to my personal github, and then I re-tried the $heroku create and $ git push heroku master commands and they worked like a charm.
Sorry if Late but i discovered it lately after 2 hours googling to find an answer
The PROBLEM was that i renamed the file "procfile" with lowercase p. So I renamed it to "Procfile" with Uppercase P. then i recreated the git repo then added them to stage then committed them. after that i pushed my branch in my case "master" to heroku and it worked fine for me.
I'm just saying it in case any one got stucked in the same error.
I had this frustrating problem, but I finally got my procfile to work. 1st make sure that you name it "Procfile" without a ".exe" or ".txt" or ".bat". Just "Procfile". For Django I included the following each in it's own line inside the Procfile:
web:python manage.py runserver
web: gunicorn app-name.wsgi
heroku ps:scale web=1
Then even if you have done this before, you need to use cmd to cd into the file where your project is and enter the following commands and hit after each command:
pip freeze > requirements.txt
git init
git add .
git status
git commit -m "Initial Commit"
git push heroku master
heroku open
This is what worked for me.
I've just had this problem, create the Procfile with the command, not by renaming a created-file:
echo web:..etc>Procfile (without spaces)

Categories

Resources