Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 7072

Why can't I "deactivate" pyenv / virtualenv? How to "fix" installation

$
0
0

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 apt and pip/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 environment, Bash gives me a modified prompt, and it seems I can't get the usual prompt by deactivate, source deactivate, etc...

(general) $ deactivatepyenv-virtualenv: deactivate must be sourced. Run 'source deactivate' instead of 'deactivate'(general) $ source deactivatepyenv-virtualenv: deactivate 3.6.0/envs/general(general) $ pyvenv deactivatepyenv: pyvenv: command not foundThe `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 deactivate the (general) environment?
  • How can I tell if my installation is wrong, and how can I fix it?
  • Wow 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 highlights that

  • python venv should be preferred;
  • it is available on Python >=3.3;
  • Ubuntu Xenial doesn't have it already installed by default;
  • 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/          .vimrccache/        .git/         plugins/      test/         CHANGELOG.md  .gitignore    pyenv.d/      .travis.yml   COMMANDS.md   libexec/      README.md     version       (general) $ cat .pyenv/versiongeneral(general) $ ls -l ~/.pyenv/versionstotale 12drwxrwxr-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.


Viewing all articles
Browse latest Browse all 7072

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>