Mac terminal, conda --version, 'command not found' - python

I am on a Mac. The terminal window doesn't seem to be able to access my bin or bash folder anymore, I'm not sure.
In the terminal window I am typing conda --version to determine which version of Anaconda I have installed but I get the message -bash: conda: command not found. - Also when I am in Atom, and am using the Python text editor and I'm trying to create a virtual environment, I type sudo conda create --name myDjangoEnv django and I get the same message, sudo: conda: command not found.
I used sudo because otherwise it would not let me set up a virtual environment without entering a password.
I think I edited the bash profile when I set up the virtual environment.
The thing is, I was able to do all of this yesterday, when I typed conda --version in my terminal I got the version of anaconda I installed, and I was able to update the version of anaconda. And in the python editor in Atom, when I typed sudo conda create --name myDjangoEnv django it set up a virtual environment. I was also able to update to the latest version of django.
Additionally, I had a new problem. In Atom I couldn't install a package. if I hit install a package, nothing would happen. Yesterday I was able to install packages. However I restarted Atom and now I am able to install packages, but I'm still having the problem listed above.
Does anyone know what is going on? I'm pretty new to all of this stuff. Should I reinstall Atom, Anaconda, django, and Python? Perhaps, I didn't install it to the right location? Is it easier to run all these programs on windows 10?
Atom is installed in /Users/myusername/Downloads
django: there's no .app for django so its hard to tell where its installed. Some of the folders for django are installed here:
/Users/myusername/newproject/newenv/lib/python3.7/site-packages
or another django folder's location is here:
/Users/myusername/opt/anaconda3/lib/python3.8/site-packages/bokeh/server
python: there are so many python folders, 1 python 3.8 folder's location is:
/Users/myusername/opt/anaconda3/pkgs/lxml-4.5.2-py38h63b7cb6_0/lib
Anaconda: /Users/myusername/opt/anaconda3
echo "$PATH" produces
/Volumes/myExternalDrive/opt/anaconda3/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
conda is installed in: /Users/myUserName/opt/anaconda3/pkgs/conda-4.8.3-py38_0/info/test/tests/test-recipes/activate_deactivate_package/src/etc –

Your PATH appears to have an incorrect component. Where you see
/Volumes/myExternalDrive/opt/anaconda3/bin
you should apparently have
/Users/myusername/opt/anaconda3/bin
At a terminal prompt, you can temporarily fix this with
PATH=/Users/myusername/opt/anaconda3/bin:$PATH
and at that point, you should be able to run conda --version and python3 in that terminal instance, until you terminate it.
The proper permanent fix is to find the place where this was incorrectly configured, and correct it there; probably your .bashrc needs a more thorough cleanup, but that's already far outside the scope of your original question.
(This assumes your home directory is /Users/myusername; the command echo "$HOME" should confirm this. That's where you'd look for .bashrc too.)

Related

Can't set up virtual environment or see if Anaconda is installed, can't access bash folder, 'command not found'

I am on a mac. the terminal window doesn't seem to be able to access my bin or bash folder anymore, I'm not sure.
In the terminal window I am typing 'conda --version' to determine which version of Anaconda I have installed but I get the message "-bash: conda: command not found" - Also when I am in Atom, and am using the python text editor and I'm trying to create a virtual environment, I type 'sudo conda create --name myDjangoEnv django' and I get the same message, 'sudo: conda: command not found'. I used sudo because otherwise it would not let me set up a virtual environment. I thought I had to enter a password to set up a virtual environment on a mac, and it worked yesterday. I think I edited the bash profile when I set up the virtual environment.
I was able to do all of this yesterday, when I typed 'conda --version' in my terminal I got the version of anaconda I installed, and I was able to update the version of anaconda. And in the python editor in Atom, when I typed ''sudo conda create --name myDjangoEnv django'-it set up a virtual environment. I was also able to update to the latest version of django.
Does anyone know what is going on? I'm pretty new to all of this stuff. Should I reinstall Atom, Anaconda, django, and Python? Perhaps, I didn't install it to the right location? Is it easier to run all these programs on windows 10? Thanks for any help.
atom is installed in: Macintosh HD/Users/myusername/Downloads
django: there's no .app for django so its hard to tell where its installed. some of the folders for django are installed here:
Macintosh HD /Users/myusername/newproject/newenv/lib/python3.7/site-packages
or another django folder's location is here:
Macintosh HD /Users/myusername/opt/anaconda3/lib/python3.8/site-packages/bokeh/server
python: there are so many python folders, 1 python 3.8 folder's location is:
Macintosh HD/Users/myusername/opt/anaconda3/pkgs/lxml-4.5.2-py38h63b7cb6_0/lib
Anaconda: Macintosh HD/Users/myusername/opt/anaconda3

Configure a Pipenv environment in pycharm

I am trying to add pipenv in project interpreter in pycharm but it throws an error.
These are the step that I followed :
-1- First in the command prompt I installed pip install pipenv
-2- Go to the directory of my project in the command prompt and typed pipenv shell (This command will look for the pipenv environment and load it, otherwise if not existing will create a new one)
-3- To install the last successful environment recorded (all packages and dependencies) typed pipenv install --ignore-pipfile to install production environment
-4- In PyCharm File->Settings->Project: ProjectName->Project Interpreter click add
-5- select pipenv environment, pycharm automatically shows pipenv executable
-6- Press OK - What am I miising here?
I installed pipeline globally and on my project directory
Runing pipenv shell on project directory shows this
Shell for C:\Users\gh8001\.virtualenvs\churn_prediction-UB3VC30i already activated.
No action taken to avoid nested environments.
In step 3, once you used 'pipenv install --ignore-pipfile' you already created a virtual environment. You need to get pycharm to use this existing virtual environment (not create a new virtual env). So, in step 5, instead of selecting 'pipenv environment', which seeks to create a new virtual env (and which I find doesn't work well for specifying exact python versions well), do this instead:
select 'Virtualenv Environment' tab
then 'Existing Environment' button
then point to the interpreter you created in step 3. You can find this interpreter by using 'pipenv --venv' for the root env directory, and then add /bin/python to the end.
Select OK, and the new pipenv should be in use
I faced the same problem. I spend half a day and finally found that the problem is in the stage of installing python.
Just uncheck the Install launcher for all users(recommended)
This option saves some of the python files such as pipenv.exe in the root C:\Users\your_pc\AppData\Roaming\ and causes the problem.
Hope this works for you.
pipenv executable should point to a pipenv.exe file, not a python.exe file. I don't know why pycharm would incorrectly detect this.
I think you may install pipenv using pip in anaconda. So you can find you pipenv executable in your anaconda/bin directory.

Linux: Conda not working on installing Anaconda

I have installed Anaconda for python2 as per official documentation. In the end I received message about successful installation. To check I typed ipython and its terminal is displayed successfully but on doing conda --version nothing comes. I have checked following:
which python : It gives /home/username/anaconda2/bin/python
sha of downloaded package: It is correct
Other Anaconda installed package (ipython): It's terminal comes up
which conda: /home/username/anaconda2/bin/conda
Closed terminal and again open it(mentioned in docs). Checked after shutdown also !
On doing anaconda-navigator following message comes:
Please activate the conda root enviroment properly before running the
anaconda-navigator command.
To activate the environment please open a terminal and run:
source /home/username/anaconda2/bin/activate root
For more information please see the documentation at:
https://docs.anaconda.com/anaconda/navigator/
On doing as suggested above, nothing happens and the problem persists. Since I am new to this, might be missing something tivial, please suggest?
I was facing the exact same issue on Ubuntu 17.04 x64. In my case it was the usage of a different shell than the default (bash).
I installed the program using my ZSH shell.
During installation it asks:
Do you wish the installer to prepend the Anaconda<2 or 3> install
location to PATH in your /home/user/.bashrc ?
That made me try to run the Anaconda Navigator using bash shell (just use the bash command to switch). And yes it worked.
If you look into the .bashrc you will notice that the installer appended something like:
export PATH="/home/user/anaconda2/bin:$PATH"
If you export the path to ZSH (or any other shell you use) then it will work with your shell as well. In the case of ZSH just copy the export PATH line to the end of .zshrc

zsh: conda not found even after included in path and installed

I was doing something & I messed up everything. Now if I type conda in terminal and it says zsh conda not found
Here's my .zshrc file
alias python='python3'
# added by Anaconda3 4.4.0 installer
export PATH="/Users/abhimanyuaryan/anaconda/bin:$PATH"export PATH="/usr/local/opt/opencv3/bin:$PATH"
I tried re-installing anaconda but it says it's already installed in my home directory consider upgrading anacoda and then installation fails
with a message that installer failed with an error contact manufacturer for assitance
Removed anaconda completely and reinstalled anaconda fixed this problem
I faced the same issue in my macOS Catalina, tried everything but nothing went on work, at last I found the way how to git rid of this error, just follow few steps and you will get an amazing result.
step one - press command and space, and type users on the spotlight search, type users, you will see your computer name click on it and in the upper search bar for searching folder files of the finder, type anconda (your version) and delete the folder.
step two - download and install it back but be careful in the step of installation when your are installing it for yourself, rather go for the disk and click on the disk then click on the change location and add the location of (Users/computer name/ ) and then install it, it's all done!, try this command conda --version , if it works it means you are able to work with conda, check your python version as well: by the command python --version .

PIP command doesn't work inside virtual environment

The interpreter I use is
and it works in virtual environment. I have both anaconda and python interpreter installed in my system
But if I want to install something using pip for instance "Flask" then it happens
I am using Linux Mint 18.1 Serena"
And the way I tried to create the virtual environment is
Lastly there is no space in the directories where I tried to create virtual environment
Then I tried this link
Specifically the following commands
All those things didn't solve my problem and lastly I ended with the following errors each time I open my shell
Then I change my source of bashrc & bashrc-org to
virtualenv
export WORKON_HOME=~/virtualenvs
source /home/cryptosilicon/anaconda3/bin/python
Now get the following error
How do I correct the error and make the pip work inside virtual environment ?
I just solved (or at least found a work-around) for a similar problem.
I am using Linux Mint 18 and python 3.
I was trying to install a dependency inside a Python virtual environment using pip and it would fail (and actually pretty much mess up my whole virtual env).
The message was : "bad interpreter: No such file or directory".
But I noticed that the referenced path was actually truncated at the first space.
So I tested an virtual env in a folder for which path there is no space and it worked.

Categories