AWS Cloud9: Python virtual environment is not actually activated. Uses system-wide python
Asked Answered
C

0

4

Just starting out with AWS Cloud9. Started a new project (Django with Beanstalk).

Opened Cloud9 environment, typed in virtualenv --python=/usr/bin/python3.6 venv

then, when i type: sourse venv/bin/activate

i see: (venv) USERNAME:$

So, it looks ok, but python --version gives me 2.7.

Even more, when I install packages with "activated" virtual environment I get them installed in system-wide python 2.7.

Comportment answered 31/8, 2018 at 4:46 Comment(3)
What happens when you type "python3 --version"? Also, I'm no Python expert, but I recommend using "conda" from Miniconda as my environment and package manager. I actually had a similar question to yours, and I found my answer (maybe it helps you): #54102977Hyehyena
I'd imagine it'd be python 3.5, since it's default for Ubuntu. The problem is, it's still system-wide python. Also, your solution is not really a solution. You just call python executable with a full path, but you still don't use virtual environment. So to install pip package you will need to use full path for your pip as well. Like: /home/ubuntu/anaconda3/envs/ijackweb/bin/pip3.6 install -r requirements.txt which is the same as not using virtual environment at all.Comportment
I do have a virtual environment. It's a conda virtual environment, and when I activate it with "source activate <env_name>", either conda or pip will install packages into the environment. My question was a bit different--it was about configuring AWS Cloud9 to use the Python inside the conda environment, rather than the system-installed version of Python.Hyehyena

© 2022 - 2024 — McMap. All rights reserved.