I am in the process of migrating a Django app from Heroku to Elastic Beanstalk. It is working fine in Heroku as is.
I am getting the error Your requirements.txt is invalid. Snapshot your logs for details. When I dive into the eb-activity.log I see the failure seems to be related to atlas and scipy. I don't understand why requirements.txt is invalid on aws but valid on heroku. Insight into what is causing this error and how to remedy would be greatly appreciated.
My eb-activity.log
/opt/python/run/venv/local/lib64/python3.4/site-packages/numpy/distutils/system_info.py:572: UserWarning:
Atlas (http://math-atlas.sourceforge.net/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [atlas]) or by setting
the ATLAS environment variable.
self.calc_info()
/opt/python/run/venv/local/lib64/python3.4/site-packages/numpy/distutils/system_info.py:572: UserWarning:
Lapack (http://www.netlib.org/lapack/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [lapack]) or by setting
the LAPACK environment variable.
self.calc_info()
/opt/python/run/venv/local/lib64/python3.4/site-packages/numpy/distutils/system_info.py:572: UserWarning:
Lapack (http://www.netlib.org/lapack/) sources not found.
Directories to search for the sources can be specified in the
numpy/distutils/site.cfg file (section [lapack_src]) or by setting
the LAPACK_SRC environment variable.
self.calc_info()
Running from scipy source directory.
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-ix0qk_kf/scipy/setup.py", line 416, in <module>
setup_package()
File "/tmp/pip-build-ix0qk_kf/scipy/setup.py", line 412, in setup_package
setup(**metadata)
File "/opt/python/run/venv/local/lib64/python3.4/site-packages/numpy/distutils/core.py", line 135, in setup
config = configuration()
File "/tmp/pip-build-ix0qk_kf/scipy/setup.py", line 336, in configuration
config.add_subpackage('scipy')
File "/opt/python/run/venv/local/lib64/python3.4/site-packages/numpy/distutils/misc_util.py", line 1029, in add_subpackage
caller_level = 2)
File "/opt/python/run/venv/local/lib64/python3.4/site-packages/numpy/distutils/misc_util.py", line 998, in get_subpackage
caller_level = caller_level + 1)
File "/opt/python/run/venv/local/lib64/python3.4/site-packages/numpy/distutils/misc_util.py", line 935, in _get_configuration_from_setup_py
config = setup_module.configuration(*args)
File "scipy/setup.py", line 15, in configuration
config.add_subpackage('linalg')
File "/opt/python/run/venv/local/lib64/python3.4/site-packages/numpy/distutils/misc_util.py", line 1029, in add_subpackage
caller_level = 2)
File "/opt/python/run/venv/local/lib64/python3.4/site-packages/numpy/distutils/misc_util.py", line 998, in get_subpackage
caller_level = caller_level + 1)
File "/opt/python/run/venv/local/lib64/python3.4/site-packages/numpy/distutils/misc_util.py", line 935, in _get_configuration_from_setup_py
config = setup_module.configuration(*args)
File "scipy/linalg/setup.py", line 20, in configuration
raise NotFoundError('no lapack/blas resources found')
numpy.distutils.system_info.NotFoundError: no lapack/blas resources found
non-existing path in 'scipy/integrate': 'quadpack.h'
----------------------------------------
Command "/opt/python/run/venv/bin/python3.4 -c "import setuptools, tokenize;__file__='/tmp/pip-build-ix0qk_kf/scipy/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-s8me7lme-record/install-record.txt --single-version-externally-managed --compile --install-headers /opt/python/run/venv/include/site/python3.4/scipy" failed with error code 1 in /tmp/pip-build-ix0qk_kf/scipy
You are using pip version 7.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
2017-08-29 05:20:43,974 ERROR Error installing dependencies: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1
Traceback (most recent call last):
File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 22, in main
install_dependencies()
File "/opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py", line 18, in install_dependencies
check_call('%s install -r %s' % (os.path.join(APP_VIRTUAL_ENV, 'bin', 'pip'), requirements_file), shell=True)
File "/usr/lib64/python2.7/subprocess.py", line 541, in check_call
raise CalledProcessError(retcode, cmd)
CalledProcessError: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1 (Executor::NonZeroExitStatus)
My requirements.txt:
amqp==2.1.4
apiai==1.2.3
billiard==3.5.0.2
celery==4.0.2
certifi==2017.4.17
chardet==3.0.4
DateTime==4.2
Django==1.11.2
django-eztables==0.3.2
django-hstore==1.4.2
django-tables2==1.9.0
django.js==0.8.1
djangorestframework==3.6.3
gunicorn==19.7.1
idna==2.5
kombu==4.0.2
messagebird==1.2.0
numpy==1.13.0
psycopg2==2.7.1
pytz==2017.2
requests==2.18.1
requests-toolbelt==0.8.0
urllib3==1.21.1
vine==1.1.3
virtualenv==15.1.0
whitenoise==3.3.0
zope.interface==4.4.2
gevent==1.2.1
klein==17.2.0
boto3==1.4.4
typing==3.5.3.0
future==0.16.0
six==1.10.0
jsonschema==2.6.0
tqdm==4.11.2
scipy==0.19.0
# sklearn_crfsuite
sklearn-crfsuite==0.3.5
# spacy
spacy==1.8.2
# sklearn
scikit-learn==0.18.1
# duckling
duckling==1.7.1
# cloudpickle
cloudpickle==0.2.2
# test
python-coveralls==2.9.1
pytest-pep8==1.0.6
pytest-services==1.1.14
pytest-cov==2.5.1
pytest-twisted==1.5
pytest==3.0.7
treq==17.3.1
https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-1.2.0/en_core_web_sm-1.2.0.tar.gz
Note: the answer may be slightly relate to this question in which the user was having issues compiling scipy in Windows.
My django.config in .ebextensions
option_settings:
aws:elasticbeanstalk:container:python:
WSGIPath: presto/wsgi.py
packages:
yum:
postgresql93: []
postgresql93-devel: []
pkgconfig: []
gcc-c++: []
python34-devel: []
It may be that I need additional dependancies in order to compile requirements.txt correctly.
You need to have a BLAS/LAPACK installed (so that atlas and atlas-dev are available on your system). See this link for instructions and try adding libblas-dev and liblapack-dev to the yum list of packages in your config file.
Related
I have a Django application which it's deployed to Amazon Elastic Beanstalk(Python 3.7 running on 64bit Amazon Linux 2/3.0.3). I have installed anaconda and pythonocc-core package by creating a 10_anaconda.config file in .ebextensions folder.
10_anaconda.config;
commands:
00_download_conda:
command: 'wget https://repo.anaconda.com/archive/Anaconda3-2020.02-Linux-x86_64.sh'
01_install_conda:
command: 'bash Anaconda3-2020.02-Linux-x86_64.sh -b -f -p /anaconda'
02_conda_install_pythonocc:
command: '/anaconda/bin/conda install -y -c dlr-sc pythonocc-core=7.4.0'
Then I have created a folder in one of my apps and created a __init__.py and cadLoader.py file into that folder.
I have added the anaconda path to __init__.py which it's in the cad folder;
import sys
sys.path.append('/anaconda/lib/python3.7/site-packages')
And I have added the import lines to cadLoader.py for trying;
import os
from OCC.Extend.DataExchange import read_stl_file
from OCC.Display.SimpleGui import init_display
from OCC.Core.GProp import GProp_GProps
from OCC.Extend.DataExchange import read_step_file
from OCC.Extend.DataExchange import read_iges_file
from OCC.Core.Bnd import Bnd_Box
from OCC.Core.BRepMesh import BRepMesh_IncrementalMesh
from OCC.Core.BRepBndLib import brepbndlib_Add
from OCC.Core.BRepGProp import brepgprop_VolumeProperties
When I deployed it to Elastic Beanstalk, I got the error lines below.
from data.modellib.cad.cadLoader import CADLoader
File "/var/app/current/data/modellib/cad/cadLoader.py", line 2, in <module>
from OCC.Extend.DataExchange import read_stl_file
File "/anaconda/lib/python3.7/site-packages/OCC/Extend/DataExchange.py", line 32, in <module>
from OCC.Core.XCAFDoc import (XCAFDoc_DocumentTool_ShapeTool,
File "/anaconda/lib/python3.7/site-packages/OCC/Core/XCAFDoc.py", line 18, in <module>
from . import _XCAFDoc
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
According to this issue, I have added a .config file for installing libGL such as below:
packages:
yum:
mesa-libGL : []
mesa-libGL-devel : []
And in order to solve the version ZLIB_1.2.9 not found error, I added a config file like the one below.
commands:
00_download_zlib:
command: 'wget https://github.com/madler/zlib/archive/v1.2.9.tar.gz'
01_open_zlib:
command: 'tar xzvf v1.2.9.tar.gz'
02_into_zlib:
command: 'cd zlib-1.2.9'
03_make_zlib:
command: 'make'
04_make_install_zlib:
command: 'make install'
05_libz_so:
command: 'ln -fs /usr/local/lib/libz.so.1.2.9 /lib64/libz.so'
06_libz_so_1:
command: 'ln -fs /usr/local/lib/libz.so.1.2.9 /lib64/libz.so.1'
But my deployment is failed because of the make command. Here is my error message:
Unhandled exception during build: Command 03_make_zlib failed
Traceback (most recent call last):
File "/opt/aws/bin/cfn-init", line 171, in <module>
worklog.build(metadata, configSets)
File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 129, in build
Contractor(metadata).build(configSets, self)
File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 530, in build
self.run_config(config, worklog)
File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 542, in run_config
CloudFormationCarpenter(config, self._auth_config).build(worklog)
File "/usr/lib/python2.7/site-packages/cfnbootstrap/construction.py", line 260, in build
changes['commands'] = CommandTool().apply(self._config.commands)
File "/usr/lib/python2.7/site-packages/cfnbootstrap/command_tool.py", line 117, in apply
raise ToolError(u"Command %s failed" % name)
ToolError: Command 03_make_zlib failed
How can I fix this issue and use the OCC package in my application?
/lib64/libz.so.1: version ZLIB_1.2.9 not found
Amazon Linux 2 provides version 1.2.7:
Name : zlib
Arch : i686
Version : 1.2.7
Release : 18.amzn2
Size : 91 k
Repo : amzn2-core/2/x86_64
Summary : The compression and decompression library
URL : http://www.zlib.net/
License : zlib and Boost
Description : Zlib is a general-purpose, patent-free, lossless data compression
: library which is used by many different programs.
You can try manually upgrading the zlib to 1.2.9, for example performing the following steps as root (if they work, you can automated this through .ebextentions):
wget https://github.com/madler/zlib/archive/v1.2.9.tar.gz
tar xzvf v1.2.9.tar.gz
cd zlib-1.2.9
./configure
make
make install
ln -fs /usr/local/lib/libz.so.1.2.9 /lib64/libz.so
ln -fs /usr/local/lib/libz.so.1.2.9 /lib64/libz.so.1
This have to be carefully tested, as manual upgrades can break things. Some other options for upgrades are here.
New config file
commands:
00_download_zlib:
command: |
wget https://github.com/madler/zlib/archive/v1.2.9.tar.gz
tar xzvf v1.2.9.tar.gz
cd zlib-1.2.9
./configure
make
make install
ln -fs /usr/local/lib/libz.so.1.2.9 /lib64/libz.so
ln -fs /usr/local/lib/libz.so.1.2.9 /lib64/libz.so.1
I'm trying to install Airflow in Ubuntu 16.04. I get an error when I try:
pip install airflow
Here is the error:
Exception:
Traceback (most recent call last):
File "/home/ashim/.local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/home/ashim/.local/lib/python2.7/site-packages/pip/commands/install.py", line 342, in run
prefix=options.prefix_path,
File "/home/ashim/.local/lib/python2.7/site-packages/pip/req/req_set.py", line 784, in install
**kwargs
File "/home/ashim/.local/lib/python2.7/site-packages/pip/req/req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/home/ashim/.local/lib/python2.7/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files
isolated=self.isolated,
File "/home/ashim/.local/lib/python2.7/site-packages/pip/wheel.py", line 345, in move_wheel_files
clobber(source, lib_dir, True)
File "/home/ashim/.local/lib/python2.7/site-packages/pip/wheel.py", line 316, in clobber
ensure_dir(destdir)
File "/home/ashim/.local/lib/python2.7/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
os.makedirs(path)
File "/usr/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/dateutil'
And I'd like to mention that you should install other package such as sasl client if you want to use more subpackages(hive, hdfs, etc)
conda install -c blaze sasl=0.2.1
conda install -c conda-forge pure-sasl=0.3.0
sudo pip install airflow
or
sudo pip install "airflow[celery,postgres]"
The second command lists the extra packages needed along with airflow.
Give permission to the "/usr/local/lib/python2.7/dist-packages/dateutil" or to the enitre /usr/local/lib
I'm wanting to install ten packages via pip in virtualenv.
I possibly used sudo improperly in my haste to get it "working" as suggested by https://stackoverflow.com/a/27939356/1063287, ie I installed virtualenv with sudo:
sudo virtualenv --no-site-packages ENV
I did this because without sudo I got this:
me#my-comp:/var/www/html$ virtualenv --no-site-packages ENV
Running virtualenv with interpreter /usr/bin/python2
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/virtualenv.py", line 2364, in <module>
main()
File "/usr/lib/python3/dist-packages/virtualenv.py", line 719, in main
symlink=options.symlink)
File "/usr/lib/python3/dist-packages/virtualenv.py", line 942, in create_environment
site_packages=site_packages, clear=clear, symlink=symlink))
File "/usr/lib/python3/dist-packages/virtualenv.py", line 1144, in install_python
mkdir(lib_dir)
File "/usr/lib/python3/dist-packages/virtualenv.py", line 324, in mkdir
os.makedirs(path)
File "/usr/lib/python2.7/os.py", line 150, in makedirs
makedirs(head, mode)
File "/usr/lib/python2.7/os.py", line 150, in makedirs
makedirs(head, mode)
File "/usr/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/var/www/html/ENV'
In Ubuntu 16.04 I cannot see "Disk Utility" to test the solution offered however.
Trying to pip install lxml results in this final error:
Command "/var/www/html/ENV/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-jcCDbh/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-_oNugl-record/install-record.txt --single-version-externally-managed --compile --install-headers /var/www/html/ENV/include/site/python2.7/lxml" failed with error code 1 in /tmp/pip-build-jcCDbh/lxml/
Whilst two other examples are below:
pip install bottle:
(ENV) me#my-comp:/var/www/html/ENV$ pip install bottle
Collecting bottle
Installing collected packages: bottle
Exception:
Traceback (most recent call last):
File "/var/www/html/ENV/local/lib/python2.7/site-packages/pip/basecommand.py", line 209, in main
status = self.run(options, args)
File "/var/www/html/ENV/local/lib/python2.7/site-packages/pip/commands/install.py", line 335, in run
prefix=options.prefix_path,
File "/var/www/html/ENV/local/lib/python2.7/site-packages/pip/req/req_set.py", line 732, in install
**kwargs
File "/var/www/html/ENV/local/lib/python2.7/site-packages/pip/req/req_install.py", line 835, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/var/www/html/ENV/local/lib/python2.7/site-packages/pip/req/req_install.py", line 1030, in move_wheel_files
isolated=self.isolated,
File "/var/www/html/ENV/local/lib/python2.7/site-packages/pip/wheel.py", line 344, in move_wheel_files
clobber(source, lib_dir, True)
File "/var/www/html/ENV/local/lib/python2.7/site-packages/pip/wheel.py", line 322, in clobber
shutil.copyfile(srcfile, destfile)
File "/usr/lib/python2.7/shutil.py", line 83, in copyfile
with open(dst, 'wb') as fdst:
IOError: [Errno 13] Permission denied: '/var/www/html/ENV/lib/python2.7/site-packages/bottle.pyc'
pip install requests:
(ENV) me#my-comp:/var/www/html/ENV$ pip install requests
Collecting requests
Using cached requests-2.9.1-py2.py3-none-any.whl
Installing collected packages: requests
Exception:
Traceback (most recent call last):
File "/var/www/html/ENV/local/lib/python2.7/site-packages/pip/basecommand.py", line 209, in main
status = self.run(options, args)
File "/var/www/html/ENV/local/lib/python2.7/site-packages/pip/commands/install.py", line 335, in run
prefix=options.prefix_path,
File "/var/www/html/ENV/local/lib/python2.7/site-packages/pip/req/req_set.py", line 732, in install
**kwargs
File "/var/www/html/ENV/local/lib/python2.7/site-packages/pip/req/req_install.py", line 835, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/var/www/html/ENV/local/lib/python2.7/site-packages/pip/req/req_install.py", line 1030, in move_wheel_files
isolated=self.isolated,
File "/var/www/html/ENV/local/lib/python2.7/site-packages/pip/wheel.py", line 344, in move_wheel_files
clobber(source, lib_dir, True)
File "/var/www/html/ENV/local/lib/python2.7/site-packages/pip/wheel.py", line 315, in clobber
ensure_dir(destdir)
File "/var/www/html/ENV/local/lib/python2.7/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
os.makedirs(path)
File "/var/www/html/ENV/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/var/www/html/ENV/lib/python2.7/site-packages/requests-2.9.1.dist-info'
If I use sudo pip install bottle, I get:
sudo: pip: command not found
Update:
I ran this suggestion:
$sudo chown -R $(whoami) /var/www/html/ENV
and can now pip install bottle, requests, pymongo, beautifulsoup4, Beaker, pycrypto and tldextract. However, lxml and pillow are failing.
lxml fail:
Failed building wheel for lxml
Command "/var/www/html/ENV/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-yHLQQe/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-hLznuQ-record/install-record.txt --single-version-externally-managed --compile --install-headers /var/www/html/ENV/include/site/python2.7/lxml" failed with error code 1 in /tmp/pip-build-yHLQQe/lxml/
pillow fail:
Failed building wheel for pillow
Command "/var/www/html/ENV/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-IkuM34/pillow/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-60McJh-record/install-record.txt --single-version-externally-managed --compile --install-headers /var/www/html/ENV/include/site/python2.7/pillow" failed with error code 1 in /tmp/pip-build-IkuM34/pillow/
I have tried the suggestion here:
https://stackoverflow.com/a/6504860/1063287
for troubleshooting these remaining errors and libxml2-dev, libxslt1-dev and python2.7-dev are already installed.
Update 2:
Installed zlib1g-dev as per:
https://stackoverflow.com/a/19289133/1063287
and can install lxml now.
Still can't install pillow.
Update 3:
Installed libjpeg8-dev as per:
https://stackoverflow.com/a/33582789/1063287
and can now install pillow.
Have you installed pip?
Try installing pip by
sudo apt-get install python
,download pip from https://pip.pypa.io/en/stable/installing/ then do a 'python get-pip.py'. This will install pip
Then for the issue of permission denied use
$sudo chown -R $(whoami) /var/www/html/ENV
The solution was a combination of this suggestion:
$sudo chown -R $(whoami) /var/www/html/ENV
And making sure the following packages were installed:
python2.7-dev
libxml2-dev
libxslt1-dev ( for ^, as per https://stackoverflow.com/a/6504860/1063287)
apache2-dev
zlib1g-dev (for lxml, as per https://stackoverflow.com/a/19289133/1063287)
libjpeg8-dev (for pillow, as per https://stackoverflow.com/a/33582789/1063287)
I'm having trouble with my initial virtualenv setup on Mac OS 10.8.5.
After using pip to install, I have the following error when I try to run virtualenv:
ObLaDalocal:~ dbunz$ virtualenv
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 8, in <module>
load_entry_point('virtualenv==1.11.4', 'console_scripts', 'virtualenv')()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 318, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2221, in load_entry_point
return ep.load()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 1959, in load
raise ImportError("%r has no %r attribute" % (entry,attr))
ImportError: <module 'virtualenv' from '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/py2app/recipes/virtualenv.py'> has no 'main' attribute
ObLaDalocal:~ dbunz$ echo $PYTHONPATH
/usr/local/lib/python2.7/site-packages/matplotlib:/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/py2app/recipes/
I had to burn some things to the ground, but I was able to get virtualenv to run properly.
Set up pip for multi-version mode: (sudo easy_install -m pip)
Uninstall virtualenv: sudo pip uninstall virtualenv
Reinstall virtualenv sudo pip install virtualenv
Not particularly magical.
The latest apt-get upgrade failed with:
Setting up python2.7-minimal (2.7.3-0ubuntu3.4) ...
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site.py", line 563, in <module>
main()
File "/usr/local/lib/python2.7/site.py", line 545, in main
known_paths = addusersitepackages(known_paths)
File "/usr/local/lib/python2.7/site.py", line 278, in addusersitepackages
user_site = getusersitepackages()
File "/usr/local/lib/python2.7/site.py", line 253, in getusersitepackages
user_base = getuserbase() # this will also set USER_BASE
File "/usr/local/lib/python2.7/site.py", line 243, in getuserbase
USER_BASE = get_config_var('userbase')
File "/usr/local/lib/python2.7/sysconfig.py", line 520, in get_config_var
return get_config_vars().get(name)
File "/usr/local/lib/python2.7/sysconfig.py", line 419, in get_config_vars
_init_posix(_CONFIG_VARS)
File "/usr/local/lib/python2.7/sysconfig.py", line 298, in _init_posix
raise IOError(msg)
IOError: invalid Python installation: unable to open /usr/local/include/python2.7 /pyconfig.h (No such file or directory)
dpkg: error processing python2.7-minimal (--configure):
subprocess installed post-installation script returned error exit status 1
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Errors were encountered while processing:
python2.7-minimal
A reinstall of python2.7-minimal fails as /usr/local/include/python2.7/pyconfig.h is not found. I have alternative installs:
root#ely:~# sudo update-alternatives --config python
There are 2 choices for the alternative python (providing /usr/bin/python).
Selection Path Priority Status
------------------------------------------------------------
0 /usr/bin/python2.7 60 auto mode*
1 /usr/bin/python2.7 60 manual mode
2 /usr/bin/python3 40 manual mode
root#ely:~# whereis python
python: /usr/bin/python3.2mu /usr/bin/python2.7 /usr/bin/python2.7-config /usr/bin
/python /usr/bin/python3.2 /usr/bin/python2.7-dbg-config /usr/bin/python2.7-dbg
/etc/python2.7 /etc/python /etc/python3.2 /usr/lib/python2.7 /usr/lib/python3.2 /usr/bin
/X11/python3.2mu /usr/bin/X11/python2.7 /usr/bin/X11/python2.7-config /usr/bi/X11/python
/usr/bin/X11/python3.2 /usr/bin/X11/python2.7-dbg-config /usr/bin/X11/python2.7-dbg
/usr/local/bin/python3.2m /usr/local/bin/python2.7 /usr/local/bin/python3.2m-config
/usr/local/bin/python2.7-config /usr/local/bin/python3.2 /usr/local/bin/python3.2-config
/usr/local/lib/python2.7 /usr/local/lib/python3.2 /usr/include/python3.2mu /usr/include
/python2.7 /usr/include/python2.7_d /usr/include/python3.2 /usr/include/python3.2_d
/usr/share/python /usr/share/man/man1/python.1.gz
But pyconfig.h is only found in /usr/include/python*.*/ (as it should be?)
What is going on? How to fix (installs of other packages are affected)? Thanks.
reinstall python on ubuntu IOError: invalid Python installation: unable to open /usr/local/include/python2.7 , and then look /pyconfig.h not found , you need install this file and add it when it request you to add it