How do I add the Anaconda path to the PATH environment on a Mac? - anaconda

I have a macbook and I can't find any solutions to add the Anaconda path to the PATH environemnt online on my laptop. On Windows, you execute the installer file and this screen should show up. enter image description here
Then, I have to click the Anaconda distribution folder when I click on "choose from list" button on Eclipse but I don't have that option displayed. Supposed to look like pt. 12
What my screen looks like

On mac/linux, you need to add env path by yourself.
Find your anaconda installed path and add commands in .zshrc or .bashrc
export PATH=~/anaconda3/bin:$PATH
export PATH="/anaconda3/bin:$PATH"
Then, execute command source ~/.zshrc if you are using zsh.
Or, execute command source ~/.bashrc by default.

Related

How to import geopandas in Pycharm if installed using conda? [duplicate]

Conda env is activated using source activate env_name.
How can I activate the environment in pycharm ?
open
pycharm/preferences/project/Project Interpreter
And check existing interpreter. Conda environments may already be listed there.
If not exists, you can create a new conda environment with "Create Conda Env" button
If you are looking for a specific conda environment you can use 'add local'. When you click 'add local' you will input conda environment path + /bin/python
You can list all conda environment in your system with following commnad.
>>conda info --env
# conda environments:
#
tensorflow * /Users/username/miniconda3/envs/tensorflow
you can chose the approach best fits your needs.
The best PyCharm specific answer is this one by wasabi (below).
In general though, if you want to use an interpreter from within a Conda environment then you can change the location of the interpreter to point to the particular environment that you want to use e.g. /home/username/miniconda/envs/bunnies as mentioned in this comment.
However, as mentioned in this answer by Mark Turner, it is possible to have a shell script executed when activating an environment. This method will not run that shell script, but you can follow his workaround if you need that shell script run:
open a conda prompt
activate the environment
run pycharm from the conda prompt
How about environment.yml
Pycharm can create a new conda environment indeed. Unfortunately, until this issue is fixed, it won't offer environment.yml support, which means it won't install the dependencies declared there.
When working on a project based on such a file, you need to create / update the dedicated env manually on your machine:
conda env create -n <my-project>
Then remember to update each time environment.yml changes (from you or upstream).
conda env update -n <my-project>
Not ideal
As mentioned in one of the comments above, activating an environment can run scripts that perform other actions such as setting environment variables. I have worked in one environment that did this. What worked in this scenario was to:
open a conda prompt
activate the environment
run pycharm from the conda prompt
Pycharm then had access to the environment variables that were set by activating the environment.
I had the same problem i am on windows 10 professional 64 bit
my solution was to start Pycharm as adminstrator and it worked
Go to settings at the top right corner of the PyCharm IDE.
Go to Project:{Your Project Name}->Python Interpreter
Go to the settings inside here and click add:
In Add Python Interpreter select conda env
Select existing environment and click on your required conda environment path from the dropdown menu OR add the path of the python.exe file in your conda environment. As a reference, I am adding the path for my windows10 system: C:\Users\maria\AppData\Local\Continuum\anaconda3\envs<mycondaenv>\python.exe It can vary for your system based on installation configs.
It seems important to me to know, that setting project interpreter as described in wasabi's comment does not actually activate the conda environment.
I had issue with running xgboost (that I installed with conda) inside PyCharm and it turned out that it also need some folders added to PATH. In the end I had to make do with an ugly workaround:
Find out what are the additional folders in PATH for given environment (with echo %PATH% in cmd)
In the file I wish to run put to the top before anything else:
import os
os.environ["PATH"] += os.pathsep + os.pathsep.join(my_extra_folders_list)
I know this is not at all proper solution, but i was unable to find any other beside what Mark Turner mentioned in his comment.
To use Conda environment as PyCharm interpreter
activate Conda environment from Conda navigator
open PyCharm from the navigator tool list
in Conda Add interpreter section choose existing Conda environment and it automatically recognises the path of that environment's python.exe file
First , select Interpreter setting ... in right bottom of Pycharm.
Then choose python.exe from your desired conda environment.
My environment path is : C:\Users\javadsh\anaconda3\envs\tf-gpu\python.exe
Go to Pycharm -> Preferences -> Project Interpreter. At the top left of the packages table there is a plus sign, minus sign, a green circle and an eye; uncheck the green sign; that will let you have access to the packages while using conda environment.

Pipenv installed, but "doesn't exist"

i'm trying to install pipenv on Windows 10 to use it with Docker, i've done the following steps on my Command Line:
pip install pipenv
(output)
pipenv
output (translation: "pipenv" is not recognized as an internal or external command, operable program or batch file)
So Windows tells me pipenv is not installed. How is it possible? How i can fix this? Thank you
The first thing you should do is add python to the window system variable. If you haven't done that, follow these steps:
Type "variable" to the search bar and select "Edit the system variable".
Click on the "environment variable..." button and you should see the list of variables that has been added by window.
Select the one containing the word "path" and click "edit".
Click the new and you can add the path to which you installed python.
For example:
My python is at
c:\python
Copy that and put into the edit box and click OK.
Lastly, click OK again and you should be good to go.
After you did that, you can do this to your command line:
python pipenv
Note: make sure you have pipenv installed by pip.
I had this same problem. Tried everything that has been recommended here and elsewhere.
Verified that Pip was in path
Python39 runs fine
PyCharm runs fine.
Finally, right clicked on Python in my list of programs in Windows10 and selected modify
Checked the various boxes during the modify dialog.
Pip now loads and works fine.

Can't access conda after changing name of mac user account

When I first got my Macbook Pro, I set it up where my home folder was named
/Users/monicaheddneck/
I installed all the software I needed, like python, etc, and went about my business.
Last night, I decided to change the name of my folder to simply
/Users/monica/
and did it this way.
Fine.
Today, I decided to run jupyter notebook for the millionth time, and realized I may have borked all paths for all the libraries I have...and who knows what else.
For example,
conda --version
tells me I don't even have conda installed:
-bash: conda: command not found
My question: is there any way to fix the broken path to conda?
I am using Mac High Sierra, version 10.13.3
When using the conda installer, it asks if you want to add and export line with the path to conda in your bashrc file. My guess is that it wasn't updated when you changed the name of your account.
Have a look at your bashrc (hidden file) which should be in your home and update it as necessary ! The line should look like this:
export PATH="/Users/monicaheddneck/xxxconda/bin:$PATH"
and should be fixed appropriatly:
export PATH="/Users/monica/xxxconda/bin:$PATH"
You will then have to source your new bashrc file or restart a terminal.

changing anaconda folder path

I recently have installed anaconda in my Ubuntu machine.By mistake,i shifted the anaconda folder from my home directory to inside another folder.Now when i tried to use anaconda command in the terminal it showed the error-'command not found'. Again i shifted my anaconda folder to it's by default home directory now it's working fine.Can anyone explain this all?
Is it related to some path dependency or something.Meanwhile, if i want to use anaconda while at the same time keeping it inside other folder what changes should i make and where?
Thanks a lot for your time and help!!!
Yes, your anaconda system PATH is created as per your home directory.
You can open your bashrc file and change the anaconda path to your desired anaconda installation location
sudo nano ~/.bashrc
check for line
export PATH=/home/{username}/anaconda3/bin:$PATH
Replace /home/{username}/anaconda3/bin with your anaconda installation directory bin
Hope this helps :)

updating osx terminal after macport installation

I installed macports on my macbook pro and after the successful install, I tried typing in 'port' in a terminal tab that I had was already opened before the macport installation and it gave me the error "command not found"
When I opened another tab in the terminal and tried again, it worked. (It works in the new tab but does not work in the old one)
I am guessing that this has to do with the fact that the first tab was opened before the the macport installation took place.
Just wanted to know how to refresh the terminal after I install something like macports.
PS: I know that I can open a new tab and continue working but am just curious how to do so.
General: You can use the reset command:
reset
For more information run:
man reset
MacPorts: The PATH variable is set by the postflight script to append the MacPorts executable paths to the default path:
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
The location of this line depends on your shell, the installer may use .profile, .bash_login, .bash_profile, .tcshrc, or .cshrc.
If you want these changes to take effect in the current Terminal window, you either need to execute this command manually:
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
Or if you know which file contains the line above, you can source it. For example:
source ~/.profile

Resources