ImportError: The curl client requires the pycurl library Docker + Django - django

I'm dockerizing Django 2.2 application and using Pipenv for environment management.
I want to use SQS as broker with Django celery.
I have installed the pycurl library using Pipenv
[packages]
...
pycurl = "*"
When I run celery locally
pipenv run celery -A qcg worker -l info
It works but when I run using docker image
docker run app:latest celery -A qcg worker -l info
It gives error
ImportError: The curl client requires the pycurl library.
The command in Docerkfile used to install dependencies
RUN set -ex \
&& BUILD_DEPS=" \
build-essential \
libpcre3-dev \
libpq-dev \
libcurl4-openssl-dev libssl-dev \
" \
&& apt-get update && apt-get install -y --no-install-recommends $BUILD_DEPS \
&& export PYCURL_SSL_LIBRARY=nss \
&& pipenv install --deploy --system \
\
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $BUILD_DEPS
\
&& rm -rf /var/lib/apt/lists/*
Complete error log
[2020-05-25 17:16:22,216: CRITICAL/MainProcess] Unrecoverable error: ImportError('The curl client requires the pycurl library.')
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/kombu/asynchronous/http/__init__.py", line 20, in get_client
return hub._current_http_client
AttributeError: 'Hub' object has no attribute '_current_http_client'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/celery/worker/worker.py", line 205, in start
self.blueprint.start(self)
File "/usr/local/lib/python3.7/site-packages/celery/bootsteps.py", line 119, in start
step.start(parent)
File "/usr/local/lib/python3.7/site-packages/celery/bootsteps.py", line 369, in start
return self.obj.start()
File "/usr/local/lib/python3.7/site-packages/celery/worker/consumer/consumer.py", line 318, in start
blueprint.start(self)
File "/usr/local/lib/python3.7/site-packages/celery/bootsteps.py", line 119, in start
step.start(parent)
File "/usr/local/lib/python3.7/site-packages/celery/worker/consumer/consumer.py", line 599, in start
c.loop(*c.loop_args())
File "/usr/local/lib/python3.7/site-packages/celery/worker/loops.py", line 83, in asynloop
next(loop)
File "/usr/local/lib/python3.7/site-packages/kombu/asynchronous/hub.py", line 301, in create_loop
item()
File "/usr/local/lib/python3.7/site-packages/vine/promises.py", line 170, in __call__
return self.throw()
File "/usr/local/lib/python3.7/site-packages/vine/promises.py", line 167, in __call__
retval = fun(*final_args, **final_kwargs)
File "/usr/local/lib/python3.7/site-packages/kombu/transport/SQS.py", line 390, in _schedule_queue
queue, callback=promise(self._loop1, (queue,)),
File "/usr/local/lib/python3.7/site-packages/kombu/transport/SQS.py", line 406, in _get_bulk_async
return self._get_async(queue, maxcount, callback=callback)
File "/usr/local/lib/python3.7/site-packages/kombu/transport/SQS.py", line 416, in _get_async
qname, count=count, connection=self.asynsqs(queue=qname),
File "/usr/local/lib/python3.7/site-packages/kombu/transport/SQS.py", line 566, in asynsqs
region=self.region
File "/usr/local/lib/python3.7/site-packages/kombu/asynchronous/aws/sqs/connection.py", line 27, in __init__
**kwargs
File "/usr/local/lib/python3.7/site-packages/kombu/asynchronous/aws/connection.py", line 194, in __init__
**http_client_params)
File "/usr/local/lib/python3.7/site-packages/kombu/asynchronous/aws/connection.py", line 151, in __init__
self._httpclient = http_client or get_client()
File "/usr/local/lib/python3.7/site-packages/kombu/asynchronous/http/__init__.py", line 22, in get_client
client = hub._current_http_client = Client(hub, **kwargs)
File "/usr/local/lib/python3.7/site-packages/kombu/asynchronous/http/__init__.py", line 13, in Client
return CurlClient(hub, **kwargs)
File "/usr/local/lib/python3.7/site-packages/kombu/asynchronous/http/curl.py", line 43, in __init__
raise ImportError('The curl client requires the pycurl library.')
ImportError: The curl client requires the pycurl library.

I was getting the same error and this worked for me: pip install celery[sqs]

This issue was with the libcurl4-nss-dev libssl-dev installation.
In the following installation script
RUN set -ex \
&& BUILD_DEPS=" \
build-essential \
libpcre3-dev \
libpq-dev \
libcurl4-openssl-dev libssl-dev \
" \
&& apt-get update && apt-get install -y --no-install-recommends $BUILD_DEPS \
&& export PYCURL_SSL_LIBRARY=nss \
&& pipenv install --deploy --system \
\
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $BUILD_DEPS
\
&& rm -rf /var/lib/apt/lists/* ```
The libcurl4-nss-dev libssl-dev installation is removed after the Pipenv install. So the package library couldn't be located.
After separating installation of libcurl4-nss-dev libssl-dev works for me.
RUN apt-get install -y --no-install-recommends libcurl4-nss-dev libssl-dev

Related

ImportError: libGL.so.1: cannot open shared object file: No such file or directory while importing OCC

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

Django, Docker, collectstatic, UnicodeEncodeError: 'utf-8' codec can't encode characters in position 0-1: surrogates not allowed

I hope you can help me here. I’m getting a UnicodeEncodeError when running a ‘collectstatic’ in Django 3.0.6. I previously fixed a similar error by setting the locale environment variables LANG and LC_ALL to UTF-8, but this doesn’t seem to work in this case.
My Django project runs in containers (Docker version 18.03.1-ce) and I have just upgraded to Django 3.0.6. Also, in the process, moved to Python 3.6 from Python 2.7. The container is built "FROM python:3.6". Everything works except collectstatic. The static files are stored in an S3 bucket and was all working fine before the upgrade (I had to fix a number of Django things due to the Python upgrade, but all predictable and documented).
The locale settings in the container (with error messages) are:
root# locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8
And the message when running collectstatic (from within the container):
root# python manage.py collectstatic
You have requested to collect static files at the destination
location as specified in your settings.
This will overwrite existing files!
Are you sure you want to do this?
Type 'yes' to continue, or 'no' to cancel: yes
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 401, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 395, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 328, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 369, in execute
output = self.handle(*args, **options)
File "/usr/local/lib/python3.6/site- packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 187, in handle
collected = self.collect()
File "/usr/local/lib/python3.6/site- packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 113, in collect
handler(path, prefixed_path, storage)
File "/usr/local/lib/python3.6/site- packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 338, in copy_file
if not self.delete_file(path, prefixed_path, source_storage):
File "/usr/local/lib/python3.6/site- packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 248, in delete_file
if self.storage.exists(prefixed_path):
File "/usr/local/lib/python3.6/site-packages/storages/backends/s3boto.py", line 464, in exists
return self._get_key(name) is not None
File "/usr/local/lib/python3.6/site-packages/storages/backends/s3boto.py", line 450, in _get_key
return self.bucket.get_key(self._encode_name(name))
File "/usr/local/lib/python3.6/site-packages/boto/s3/bucket.py", line 193, in get_key
key, resp = self._get_key_internal(key_name, headers, query_args_l)
File "/usr/local/lib/python3.6/site-packages/boto/s3/bucket.py", line 200, in _get_key_internal
query_args=query_args)
File "/usr/local/lib/python3.6/site-packages/boto/s3/connection.py", line 654, in make_request
path = self.calling_format.build_path_base(bucket, key)
File "/usr/local/lib/python3.6/site-packages/boto/s3/connection.py", line 98, in build_path_base
key = boto.utils.get_utf8_value(key)
File "/usr/local/lib/python3.6/site-packages/boto/utils.py", line 863, in get_utf8_value
value = value.encode('utf-8')
UnicodeEncodeError: 'utf-8' codec can't encode characters in position 0-1: surrogates not allowed
The Dockerfile snippet:
#FROM ubuntu:14.04
FROM python:3.6
MAINTAINER Paul Young
# Set the locale
#RUN apt-get -y install locales
#RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
# locale-gen
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
RUN apt-get update
RUN apt-get install -y python python-pip python-dev
RUN apt-get install -y libxml2-dev libxslt-dev libffi-dev libssl-dev
#RUN apt-get install -y libmysqlclient-dev
RUN apt-get install -y default-libmysqlclient-dev
And I am quite sure I have probably missed something very obvious! Thank you...
I commented out the following from the Dockerfile and re-built the container and for some reason this fixed the problem:
#ENV LANG en_US.UTF-8
#ENV LANGUAGE en_US:en
#ENV LC_ALL en_US.UTF-8

How to install django-channels in ubuntu?

I have tried to install django channels using this command.
pip install -U channels
but am getting this error
Downloading/unpacking channels Downloading
channels-2.0.2-py2.py3-none-any.whl Cleaning up... Exception:
Traceback (most recent call last): File
"/home/praneet/pral/myvenv/lib/python-wheels/setuptools-3.3-py2.py3-none-any.whl/pkg_resources.py",
line 2482, in _dep_map
return self.dep_map File "/home/praneet/pral/myvenv/lib/python-wheels/setuptools-3.3-py2.py3-none-any.whl/pkg_resources.py",
line 2344, in __getattr
raise AttributeError(attr) AttributeError: _DistInfoDistribution__dep_map
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File
"/home/praneet/pral/myvenv/lib/python3.4/site-packages/pip/basecommand.py",
line 122, in main
status = self.run(options, args) File "/home/praneet/pral/myvenv/lib/python3.4/site-packages/pip/commands/install.py",
line 278, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle) File
"/home/praneet/pral/myvenv/lib/python3.4/site-packages/pip/req.py",
line 1266, in prepare_files
req_to_install.extras): File "/home/praneet/pral/myvenv/lib/python-wheels/setuptools-3.3-py2.py3-none-any.whl/pkg_resources.py",
line 2291, in requires
dm = self._dep_map File "/home/praneet/pral/myvenv/lib/python-wheels/setuptools-3.3-py2.py3-none-any.whl/pkg_resources.py",
line 2484, in _dep_map
self.__dep_map = self._compute_dependencies() File "/home/praneet/pral/myvenv/lib/python-wheels/setuptools-3.3-py2.py3-none-any.whl/pkg_resources.py",
line 2508, in _compute_dependencies
parsed = next(parse_requirements(distvers)) File "/home/praneet/pral/myvenv/lib/python-wheels/setuptools-3.3-py2.py3-none-any.whl/pkg_resources.py",
line 2605, in parse_requirements
line, p, specs = scan_list(VERSION,LINE_END,line,p,(1,2),"version spec") File
"/home/praneet/pral/myvenv/lib/python-wheels/setuptools-3.3-py2.py3-none-any.whl/pkg_resources.py",
line 2573, in scan_list
raise ValueError("Expected "+item_name+" in",line,"at",line[p:]) ValueError: ('Expected version spec in', 'asgiref ~=2.1', 'at', '
~=2.1')
Storing debug log for failure in /home/praneet/.pip/pip.log
I was also stuck with same issue.
Now,I have fixed it by installing following packages:
python2
sudo apt-get install python-dev python-pip libxml2-dev libxslt1-dev zlib1g-dev libffi-dev libssl-dev
python3
sudo apt-get install python3-dev python3-pip libxml2-dev libxslt1-dev zlib1g-dev libffi-dev libssl-dev

pip install produces OSError: [Errno 13] Permission denied:

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)

Virtualenv.py has no main attirute

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.