Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AttributeError: install_layout when attempting to install a package in a virtual environment

Tags:

I am trying to set up a virtual environment on my Ubuntu 15.10 PC. From my home directory, I have run the following commands:

virtualenv python source python/bin/activate pip install ujson 

Below is the (bottom half of) content of ~/.pip/pip.log:

running build                                                                      running build_ext                                                                  building 'ujson' extension                                                         creating build                                                                     creating build/temp.linux-x86_64-2.7                                               creating build/temp.linux-x86_64-2.7/python                                        creating build/temp.linux-x86_64-2.7/lib                                           distcc clang-3.7 -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I./python -I./lib -I/usr/include/python2.7 -c ./python/ujson.c -o build/temp.linux-x86_64-2.7/./python/ujson.o -D_GNU_SOURCE  distcc clang-3.7 -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I./python -I./lib -I/usr/include/python2.7 -c ./python/objToJSON.c -o build/temp.linux-x86_64-2.7/./python/objToJSON.o -D_GNU_SOURCE  distcc clang-3.7 -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I./python -I./lib -I/usr/include/python2.7 -c ./python/JSONtoObj.c -o build/temp.linux-x86_64-2.7/./python/JSONtoObj.o -D_GNU_SOURCE  distcc clang-3.7 -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I./python -I./lib -I/usr/include/python2.7 -c ./lib/ultrajsonenc.c -o build/temp.linux-x86_64-2.7/./lib/ultrajsonenc.o -D_GNU_SOURCE  distcc clang-3.7 -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I./python -I./lib -I/usr/include/python2.7 -c ./lib/ultrajsondec.c -o build/temp.linux-x86_64-2.7/./lib/ultrajsondec.o -D_GNU_SOURCE  creating build/lib.linux-x86_64-2.7                                                gcc -pthread -shared build/temp.linux-x86_64-2.7/./python/ujson.o build/temp.linux-x86_64-2.7/./python/objToJSON.o build/temp.linux-x86_64-2.7/./python/JSONtoObj.o build/temp.linux-x86_64-2.7/./lib/ultrajsonenc.o build/temp.linux-x86_64-2.7/./lib/ultrajsondec.o -L/usr/lib -lpython2.7 -o build/lib.linux-x86_64-2.7/ujson.so  running install_lib                                                                Traceback (most recent call last):                                                   File "<string>", line 1, in <module>                                               File "/tmp/pip-build-v2tojT/ujson/setup.py", line 69, in <module>                    classifiers=CLASSIFIERS,                                                         File "/usr/lib/python2.7/distutils/core.py", line 151, in setup                      dist.run_commands()                                                              File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands               self.run_command(cmd)                                                            File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command                cmd_obj.run()                                                                    File "/home/quant/python/lib/python2.7/site-packages/setuptools/command/install.py", line 61, in run      return orig.install.run(self)                                                    File "/usr/lib/python2.7/distutils/command/install.py", line 575, in run             self.run_command(cmd_name)                                                       File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command                 self.distribution.run_command(command)                                           File "/usr/lib/python2.7/distutils/dist.py", line 971, in run_command                cmd_obj.ensure_finalized()                                                       File "/usr/lib/python2.7/distutils/cmd.py", line 109, in ensure_finalized            self.finalize_options()                                                          File "/home/quant/python/lib/python2.7/site-packages/setuptools/command/install_lib.py", line 17, in finalize_options      self.set_undefined_options('install',('install_layout','install_layout'))        File "/usr/lib/python2.7/distutils/cmd.py", line 302, in set_undefined_options       getattr(src_cmd_obj, src_option))                                                File "/usr/lib/python2.7/distutils/cmd.py", line 105, in __getattr__                 raise AttributeError, attr                                                     AttributeError: install_layout                                                     ----------------------------------------                                          Cleaning up...                                                                    Command /home/quant/python/bin/python2 -c "import setuptools, tokenize;__file__='/tmp/pip-build-v2tojT/ujson/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-rkdmJT-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/quant/python/include/site/python2.7 failed with error code 1 in /tmp/pip-build-v2tojT/ujson Exception information:                                                            Traceback (most recent call last):                                                  File "/home/quant/python/lib/python2.7/site-packages/pip/basecommand.py", line 122, in main     status = self.run(options, args)                                                File "/home/quant/python/lib/python2.7/site-packages/pip/commands/install.py", line 309, in run     requirement_set.install(install_options, global_options, root=options.root_path)   File "/home/quant/python/lib/python2.7/site-packages/pip/req.py", line 1436, in install     requirement.install(install_options, global_options, *args, **kwargs)           File "/home/quant/python/lib/python2.7/site-packages/pip/req.py", line 707, in install     cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)     File "/home/quant/python/lib/python2.7/site-packages/pip/util.py", line 716, in call_subprocess     % (command_desc, proc.returncode, cwd))                                       InstallationError: Command /home/quant/python/bin/python2 -c "import setuptools, tokenize;__file__='/tmp/pip-build-v2tojT/ujson/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-rkdmJT-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/quant/python/include/site/python2.7 failed with error code 1 in /tmp/pip-build-v2tojT/ujson 

Some perhaps useful info:

(python)quant@OptiPlex-990:~$ pip --version pip 1.5.6 from /home/quant/python/lib/python2.7/site-packages (python 2.7) (python)quant@OptiPlex-990:~$ which python /home/quant/python/bin/python (python)quant@OptiPlex-990:~$ python --version Python 2.7.10 

I have tried installing other packages (e.g. numpy) with similar outcomes; the compilation finishes, but it blows up when it tries to run install_lib.

like image 789
quant Avatar asked Mar 29 '16 22:03

quant


1 Answers

Have you tried updating setuptools?

pip install -U setuptools

And then: pip install ujson

like image 97
Hexkcd Avatar answered Oct 04 '22 13:10

Hexkcd