0

The situation: I'm trying to install pyside on a project using the PyCharm IDE, however it says that it does not support python 3.5 that is installed by default on ubuntu 16.04. It does support python 2.7, however I'd rather not start a new project using python 2.

What I've done: So I download python 3.45, extracted it, and I am successful in installing it to a directory using the following command:

`cd /path/to/extracted/python34
./configure --prefix=/path/to/install/dir
make
make install`

The next step is to create a virtualenv out of the newly installed python 3.4, so that it will have its own pip and other tools, so I run the following code:

cd /path/to/virtualenv/script ./virtualenv.py --python=/path/to/python34 /path/to/desired/virtualenv/dir

which fails, unfortunately

What went wrong: I attempt to use the newly installed Python 3.4 to create a virtualenv, however I am met with errors when I do so. The result is the same whether I create the virtualenv using the builtin PyCharm tool, or even if I use a downloaded source of the virtualenv script. However, I was able to find out that the first error was about zlib, and I attempted to apply the solutions found here: building Python from source with zlib support

The zlib issue was resolved by logging in as administrator, and installing zlib1g-dev through:

sudo apt-get install zlib1g-dev

I also uncommented the following line from the Modules/Setup file of the extracted Python 3.4 source

zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz

But even with the zlib issue resolved, I am now met with the following error log when trying to create a virtualenv using the freshly installed python 3.4:

`

Installing setuptools, pip, wheel...
  Complete output from command /home/work/Documents...gQtEnv/bin/python3.4 - setuptools pip wheel:
  Traceback (most recent call last):
  File "<stdin>", line 7, in <module>
  File "/home/work/Documents/programming/tools/virtualenv-15.0.3/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/__init__.py", line 16, in <module>
  File "/home/work/Documents/programming/tools/virtualenv-15.0.3/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/vcs/subversion.py", line 9, in <module>
  File "/home/work/Documents/programming/tools/virtualenv-15.0.3/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/index.py", line 30, in <module>
  File "/home/work/Documents/programming/tools/virtualenv-15.0.3/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/wheel.py", line 39, in <module>
  File "/home/work/Documents/programming/tools/virtualenv-15.0.3/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/_vendor/distlib/scripts.py", line 14, in <module>
  File "/home/work/Documents/programming/tools/virtualenv-15.0.3/virtualenv_support/pip-8.1.2-py2.py3-none-any.whl/pip/_vendor/distlib/compat.py", line 66, in <module>
ImportError: cannot import name 'HTTPSHandler'
----------------------------------------
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
  File "./virtualenv.py", line 2327, in <module>
    main()
  File "./virtualenv.py", line 711, in main
    symlink=options.symlink)
  File "./virtualenv.py", line 944, in create_environment
    download=download,
  File "./virtualenv.py", line 900, in install_wheel
    call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
  File "./virtualenv.py", line 795, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /home/work/Documents...gQtEnv/bin/python3.4 - setuptools pip wheel failed with error code 1`

What I'm trying to figure out: And this is where I am now. I would like to create a virtualenv from a non-root and non-system installation of python that is built from source. I understand that I can fiddle around and do trial and error installation of what I would guess to be necessary packages until all the errors go away, however I am not keen on willy nilly installation, especially as root. I'm supposing that there must be a way to install python without root access, and create a virtual env using this. Maybe identify what the necessary packages are, download all of them, build them, and add them to my local user's system path? Unfortunately I only have a vague idea on how to do half of these. Any guidance will be appreciated.

Thanks to all those who have taken time to read this and have attempted to provide a solution. Hoping for a resolution to the issue.

B B
  • 1,116
  • 2
  • 8
  • 20
  • You might want to try doing this in a [chroot environment](https://help.ubuntu.com/community/BasicChroot). –  Sep 16 '16 at 15:19
  • Making a chroot environment seems like an extremely involved process. Furthermore, it also requires me to use sudo which is something I'm trying to avoid. I've already been successful in installing python in my home folder, I just need to create a virtualenv from it, or if not a virtualenv, at least install pip and the other tools without having to install dependencies as administrator. – B B Sep 16 '16 at 15:25
  • Does [this answer](http://stackoverflow.com/a/11301911/3657941) help? –  Sep 16 '16 at 15:30
  • I'm not certain if I'm doing the example improperly, but I'm still getting the same error. – B B Sep 16 '16 at 15:57
  • I've copy pasted the code as is, and I'm still getting the same error. I suppose that there may be no way to around this but through the installation of system wide dependencies. – B B Sep 16 '16 at 16:38
  • I managed to create a venv using https://github.com/yyuu/pyenv to install Python 3.4. But installing PySide via pip still fails due to compilation errors with sheboken. I therefore switched to PyQt5 which supports Python 3.5 and installs from inside PyCharm with no problems. – barrios Jan 06 '17 at 11:13
  • I recommend using anaconda to install python versions and virtual environments very easily – Stéphane Apr 10 '17 at 07:51

0 Answers0