I am on a freshly installed Ubuntu 16.04 and in view of developing with recent versions of pandas I installed Python 3.6.0 using a virtual environment.
A reason for choosing 3.6.0 was because I read somewhere that this version of Python could deal with virtual environments natively, i.e. without installing anything else [anyway to install 3.6.0 itself without replacing the system wide Python, which would have been almost surely wrong, I actually had to provide a virtual environment before].
I did it optimistically thinking that everything would go in the right direction (including my knowledge) and so, without caring too much about the differences between: pyenv, pyenv-virtualenv, pyvenv, etc... So I don't remember well what I installed, anyway I used only
aptandpip/pip3, trying to confine changes within the virtualenv as soon as it became available
I loosely followed this tutorial except (maybe) that I didn't create a directory for the virtualenvs (the $ mkdir ~/.virtualenvs command).
Now my user is stuck within the (general) environment and I can't get out.
Situation
Right from the start after the login, without activating any environement, bash gives me a modified prompt, and it seems I can't get the usual prompt by deactivate, source deactivate, etc...
(general) $ deactivate pyenv-virtualenv: deactivate must be sourced. Run 'source deactivate' instead of 'deactivate' (general) $ source deactivate pyenv-virtualenv: deactivate 3.6.0/envs/general (general) $ pyvenv deactivate pyenv: pyvenv: command not found The `pyvenv` command exists in these Python versions: 3.6.0 (general) $ You see that the (general) prefix remains in the prompt.
I have also had symptoms that this pyenv/virtualenv setup is affecting system activities (e.g. while trying to install hplip from the command line, the installer got confused when trying to recognize my os, and ultimately failed - I had to do it from another user, and then it worked), so I need to revert this to a clean state.
NB. I am not that sure that my installation is really that wrong, maybe it's just me issuing the wrong commands or some common pitfall I have incurred in.
The questions
- how can I
deactivatethe (general) environment - how can I tell if my installation is wrong, and how can I fix it
- how can I safely revert from this installation and get to a more proper one?
I have already read this question but it wasn't so tied to my case
This one seems more related, in that it higlights that a) python venv should be preferred; b) it is available on Python >=3.3, c) ubuntu-xenial doesn't have it already installed by deafult, d) it gives package names to install it.
But still I am unsure of what to uninstall before installing them in case.
More info
Here are the outputs of TAB completions, commands, and a directory listing, to show a bit of which environment I am in:
(general) $ cat .py <TAB> .pyenv/ .python_history (general) $ cat .pyenv/ <TAB> .agignore completions/ LICENSE shims/ versions/ bin/ CONDUCT.md Makefile src/ .vimrc cache/ .git/ plugins/ test/ CHANGELOG.md .gitignore pyenv.d/ .travis.yml COMMANDS.md libexec/ README.md version (general) $ cat .pyenv/version general (general) $ ls -l ~/.pyenv/versions totale 12 drwxrwxr-x 3 myuser myuser 4096 apr 20 13:50 ./ drwxrwxr-x 13 myuser myuser 4096 apr 20 13:50 ../ drwxr-xr-x 7 myuser myuser 4096 apr 20 13:50 3.6.0/ lrwxrwxrwx 1 myuser myuser 48 apr 20 13:50 general -> /home/myuser/.pyenv/versions/3.6.0/envs/general/ I tried listing what installed, but I'm afraid that with pip3 list the answer I get is for the env where I am stuck, and that this is masking anything that I installed before getting to it.
May it just be that I mistakenly installed pyenv from my home directory? Would it be enough to delete/move the .pyenv directory? I am not confident enough to do it without asking.
1 Answer
The way to DEACTIVATE the default PyEnv General is --pyenv uninstall 3.6.0/envs/general
(general) dhankar@dhankar-VPCEB44EN:~/.pyenv$ pyenv uninstall 3.6.0/envs/general pyenv-virtualenv: remove /home/dhankar/.pyenv/versions/3.6.0/envs/general? y dhankar@dhankar-VPCEB44EN:~/.pyenv$
to doubly ensure that the PyENV has been removed --
dhankar@dhankar-VPCEB44EN:~/.pyenv$ pyenv versions pyenv: version `general' is not installed (set by /home/dhankar/.pyenv/version) system 3.6.0 3.6.5 dhankar@dhankar-VPCEB44EN:~/.pyenv$
Also so that its documented - am sharing the terminal output of the same command , earlier before the Un-Install.
(general) dhankar@dhankar-VPCEB44EN:~/.pyenv$ pyenv versions system 3.6.0 3.6.0/envs/general 3.6.5 * general (set by /home/dhankar/.pyenv/version) (general) dhankar@dhankar-VPCEB44EN:~/.pyenv$