0

I am creating a Django App and stuck at virtualenv installation. I have seen this and tried to follow but it resulted in this everytime I tried something. Why can't it take python 3 for installing but this works virtualenv venv but it installs for python 2. What should I do?

virtualenv -p python3 venv
Running virtualenv with interpreter /home/oroborus/anaconda3/bin/python3
Using base prefix '/home/oroborus/anaconda3'
New python executable in venv/bin/python3
Also creating executable in venv/bin/python
venv/bin/python3: error while loading shared libraries: libpython3.5m.so.1.0: cannot open shared object file: No such file or directory
ERROR: The executable venv/bin/python3 is not functioning
ERROR: It thinks sys.prefix is '/home/oroborus/PycharmProjects/test-app' (should be '/home/oroborus/PycharmProjects/test-app/venv')
ERROR: virtualenv is not compatible with this system or executable

Typing locate libpython3.5

locate libpython3.5
/home/oroborus/anaconda3/envs/tensorflow/lib/libpython3.5m.so
/home/oroborus/anaconda3/envs/tensorflow/lib/libpython3.5m.so.1.0
/home/oroborus/anaconda3/envs/tensorflow/lib/python3.5/config-3.5m/libpython3.5m.a
/home/oroborus/anaconda3/lib/libpython3.5m.so
/home/oroborus/anaconda3/lib/libpython3.5m.so.1.0
/home/oroborus/anaconda3/lib/python3.5/config-3.5m/libpython3.5m.a
/home/oroborus/anaconda3/pkgs/python-3.5.2-0/lib/libpython3.5m.so
/home/oroborus/anaconda3/pkgs/python-3.5.2-0/lib/libpython3.5m.so.1.0
/home/oroborus/anaconda3/pkgs/python-3.5.2-0/lib/python3.5/config-3.5m/libpython3.5m.a
Community
  • 1
  • 1
Saras Arya
  • 3,022
  • 8
  • 41
  • 71

1 Answers1

2

In debian like distros python3-venv is available.

Install it using apt sudo apt-get install python3 python3-venv.

Then use it like that python3 -m venv yourvenvfoldername.

EDIT:

In this case anaconda is used, which has the replacement conda for both, pip and virtualenv. There is nice command comparison table available in the docs.

Creating a virtualenv with conda can be done like that:

conda create --name $ENVIRONMENT_NAME python

dahrens
  • 3,879
  • 1
  • 20
  • 38
  • Running this gave an output `python3 -m venv env Error: Command '['/home/oroborus/PycharmProjects/test-app/env/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']' returned non-zero exit status 1` – Saras Arya Oct 24 '16 at 20:03
  • might this be related http://askubuntu.com/questions/488529/pyvenv-3-4-error-returned-non-zero-exit-status-1 ? – dahrens Oct 24 '16 at 20:08
  • forget about... this should be fixed in 15.04 – dahrens Oct 24 '16 at 20:11
  • based on the comments above i've notived that you use anaconda. i guess it has something to do with it. – dahrens Oct 24 '16 at 20:15
  • 1
    anaconda has replacements for venv and pip as described [here](http://conda.pydata.org/docs/_downloads/conda-pip-virtualenv-translator.html) – dahrens Oct 24 '16 at 20:16
  • The answer above only applies to python3 on debian based distros. – dahrens Oct 24 '16 at 20:18
  • 1
    So instead of using `virtualenv` I can use `conda` do you mean to say probably with this card `conda create --name $ENVIRONMENT_NAME python` – Saras Arya Oct 24 '16 at 20:21
  • It did.. Thanks.. Could you add that to the answer so I can mark it.. :D – Saras Arya Oct 24 '16 at 22:02