I have pip installed powerline-shell in my base conda env. Switching envs yields the following error:
conda activate <env_name>
-bash: powerline-shell: command not found
I also tried running conda init powershell but it took no actions.
I have miniconda3, with conda 4.7, installed on MacOS Mojave.
I don't know a simple solution to this. I'm thinking you either need to install it in every env (which I don't recommend because it's best to avoid using pip in Conda) or you create a link to the powerline-shell binary in another location that you can keep on PATH to avoid adding the entire miniconda3/bin/ directory to PATH. I've done something like this in the past, but never with a Python entry point before.
I'd try something like
mkdir -p ~/.local/bin
ln -s /your/path/to/miniconda3/bin/powerline-shell ~/.local/bin/powerline-shell
Then add .local/bin to PATH in your .bashrc, probably toward the beginning (e.g., before the Conda section). The path here (~/.local/bin) is totally arbitrary, so adjust to your preferences. Main point is to minimize what you are exposing globally in a shell session.
Note: conda init powershell is for Windows PowerShell users.
I'm taking a course on mongodb where I have to install the mongo shell on my mac. In order to run the mongo shell, I had to change the PATH in .bash_profile. The thing is I had anaconda installed and the bash profile for conda (which I overwrote for the mongo shell). So now, my conda prompt is not usable. I created a local conda environment where I can install some python dependencies I need, but for some reason, I can't execute conda commands in the folder I created the local environment for. I keep getting a 'command not found' response. I know for sure the conda environment was activated because its listed in my anaconda navigator.
Any ideas?
So I installed Anaconda on my Ubuntu linux 12.04LTS x64 box. It seems to work fine except for this. So I created a conda environment using the
conda create -n py33dev python=3 anaconda
When I try to run the ipython shell, I would expect to get the Ipython3 shell and notebook. However, it still loads the ipython 2.7.6 shell. I tried using the ipython3 command, but it will then load an ipython3 shell from my computer and not from Anaconda.
I tried to install ipython3 to the Anaconda environment using
pip install ipython3
and
conda install ipython3
However, when I do this I just get a message saying "No packages found matching: ipython3"
So I am not sure why Anaconda runs fine with python2 but not with python3--even though Continuum indicates it is python3 ready. Am I missing a step anywhere? Does anyone know how to solve this?
Did you remember to do "source activate py33dev"?
I wan't to compile python project in emacs. This project is running in a virtualenvwrapper environment. So i found a emacs plugin called virtualenvwrapper and use M-x work-on to choose virtualenv. After i have done this, the python interpreter and shell has been set to the correct python env, but when i compile emacs with M-x compile, it still can't found all the packages installed in python env.
I found this issue may be caused by zsh. After i change the default shell to bash in terminal. virtualenv works fine. Is it a bug of zsh or i haven't configured zsh with the right way.
tow-81-235:Projects pessimisticoptimism$ mkvirtualenv development
-bash: mkvirtualenv: command not found
tow-81-235:Projects pessimisticoptimism$ sudo pip install virtualenvwrapper
Password:
Requirement already satisfied (use --upgrade to upgrade): virtualenvwrapper in /Library/Python/2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): virtualenv in /Library/Python/2.7/site-packages (from virtualenvwrapper)
Requirement already satisfied (use --upgrade to upgrade): virtualenv-clone in /Library/Python/2.7/site-packages (from virtualenvwrapper)
Cleaning up...
tow-81-235:Projects pessimisticoptimism$ mkvirtualenv development
-bash: mkvirtualenv: command not found
Why am I getting this error? I have virtualenv and virtualenvwrapper installed. I'd like to use mkvirtualenv and workon. I find it odd that virtualenv is working, but virtualenvwrapper isn't.
1st, ensure you're installing with sudo:
sudo pip install virtualenvwrapper
2nd, append the following lines to your .bashrc file (with nano ~/.bashrc):
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
3rd, reload your profile
source ~/.bashrc
Summary
I'm on a Mac and my answer is similar to #Ramces answer except it was with bash_profile. I just want to elaborate a little further for Mac users to be aware that there's a lot of different profiles including:
.bashrc
.bash_profile
.profile
Some files like .profile do not take precedence over .bash_profile (if it exists) and will then be ignored. If you successfully do the below steps and get a virtual env working, but then close out your terminal and 'workon command not found', then you need to setup for the correct profile. For a detailed answer, see here
Install Steps:
sudo pip install virtualenv
Installs virtualenv (allows you to separate your envrionments)
sudo pip install virtualenvwrapper
Installs virtualenvwrapper (allows you to use the 'workon' command)
nano ~/.bash_profile
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
source ~/.bash_profile
Reloads the profile. Going forward you only need step 5 (to create new environments) and step 6 (to run environments)
mkvirtualenv my_env
This creates your virtual environment (this example is with 'my_env')
workon my_env
This lets you work on a specific environment (this example is with 'my_env')
After installing the virtualenvwrapper package using pip, you also have to do some initialisation/set your preferences. See the introduction in the virtualenvwrapper docs.
Most relevant for finding the commands should be sourcing the virtualenvwrapper script into your shell. In the docs it is mentioned as
$ source /usr/local/bin/virtualenvwrapper.sh
You still have to adjust the path to your setup. My guess for your Mac would be:
$ source /Library/Python/2.7/site-packages/virtualenvwrapper.sh
Simple process
sudo apt-get install python-pip(if pip is not installed)
sudo pip install virtualenv
Create a dir to store your virtualenvs
mkdir ~/.virtualenvs
sudo pip install virtualenvwrapper
Run following command
export WORKON_HOME=~/.virtualenvs
Add virtualenvwrapper.sh to .bashrc
Add this line to the end of ~/.bashrc so that the virtualenvwrapper commands are loaded.
. /usr/local/bin/virtualenvwrapper.sh
you will find .bashrc.sh file in home directory by doing ctrl+h. if not then use find command to find .bashrc.sh "file ls -la ~/ | more"
Hit this command
source /usr/local/bin/virtualenvwrapper.sh
Hit this command
source ~/.bashrc
It sounds like you have multiple Python installations on your machine and virtualenvwrapper is not pointing to the right Python.
Find out which Python virtualenvwrapper is using. You get a hint where to look with which virtualenvwrapper.sh (In this case /usr/local/bin):
> /usr/local/bin/virtualenvwrapper.sh
If you don't get any return here make sure you use the correct pip when installing. The pip command might link to a different Python then you expect. Check your usr/local/bin directory for pip links (pip, pip2, pip2.7, pip3, pip3.5). It is easy to get system pip, pip2 and pip2.7 mixed up.
After you have found the Python location, add/update all paths in your .profile:
export WORKON_HOME=$HOME/venv
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python2
source /usr/local/bin/virtualenvwrapper.sh
Finally reload your profile: source ~/.profile
I am on Mac OS X 10.9.2 and for me virtualenvwrapper.sh file was present in
/usr/local/bin/virtualenvwrapper.sh
So I simply copied this into ~/.profile file:
source /usr/local/bin/virtualenvwrapper.sh
And now my ~/.profile file looks something like this:
# MacPorts Installer addition on 2014-02-23_at_17:28:39: adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
source /usr/local/bin/virtualenvwrapper.sh
And now I am able to use virtualenvwrapper commands without any issue whatsoever
Users of the Anaconda (from Continuum) distribution of Python should note that
sudo pip install virtualenvwrapper
will be anaconda-aware. So if you
which python
that should give you an idea of where to point your virtualenv in your .bashrc and/or .profile configuration files.