How to open conda shell in mac - python-3.x

I am new to conda and mac (i mostly use Ubuntu and pip). Is there a conda shell on mac (I guess I read somewhere that there is none).
If that is the case, how am I suppose to run command like:
conda env create -f environment.yml
as asked here: https://github.com/datitran/face2face-demo
I opened Anaconda Navigator then > Environment > Create > import > and in Specification File gave path of above environment.yml file.
Is the above step correct?
Is there a way to do this via shell in Mac? (I am using macOS Catalina Version 10.15.3)

I am not a Mac user, but I think you can run anaconda commands directly from the terminal, just like in Ubuntu. There's no anaconda prompt in Mac.

I was having the same problem. I opened the Anaconda Navigator program. I clicked on "Environments." Under the working environment, I clicked the right arrow and one of the options was "Open Terminal." When the terminal opened using this sequence, I was able to use the conda commands. Like you I am using Mac OS Catalina.

if in case you have clicked no during conda installation when it asked if it should be added to path or you just can't access it on your terminal for any other reason:
Run this conda update anaconda-navigator in your terminal.
But most likely it won't work because you don't have access of conda in your shell. What you have to do is run one at time the following steps in your terminal.
1st:
nano ~/.bash_profile
2nd:
export PATH=/usr/local/anaconda3/bin:$PATH
3rd:
source ~/.bash_profile
Then try:
conda
And finally make sure you exited your anaconda navigator, then run this:
conda update anaconda-navigator
This should do it, but if in case don't work out try to install homebrew in your Mac then repeat the steps.

On installing anaconda on mac it may install conda in the zsh shell. So you may want to test starting the zsh.
$ zsh
and it should start the terminal with the (base)
(base)$ conda --version
Never hurts to double check.

Related

Conda Environment not activated in Git Bash

I've installed Git Bash and I'm using python which was installed via Anaconda.
I've already activated the environment within the Conda prompt and when I open Git Bash and type python, I get an error (see image below) but when I add add Anaconda3/python it works like a charm (see same image).
Error
But I get a warning even tho I've used activate conda base in the conda prompt.
Any ideas on how to fix this?
Thanks in advance.

Can't install Spyder through Anaconda Navigator

I cannot install Spyder through Anaconda Navigator. I am a complete beginner when it comes to Python and I have no idea what's going wrong.
I have to create a new environment and open a project there.
What I did so far is: through Anaconda Navigator (1.9.7) I created a new environment (with Python 3.6). Then, for this specific environment I try to install Spyder. I click the 'install' button, a progress bar appears and then nothing happens.
I tried the same steps on friend's laptop and when I click install there, the progress bar also appears. When it's done the 'install' button changes to 'launch'. The only difference that I see between our computers is that I have Windows10 and he has a Macbook. I don't know whether this could be the problem somehow.
How can I install Spyder for a specific environment? What's going wrong with my installation in Anaconda Navigator?
Also, when I try to install Spyder through Anaconda Prompt (with Administrator privileges), I get the following error:
Preparing transaction: done
Verifying transaction: done
Executing transaction: failed
ERROR conda.core.link:_execute(568): An error occurred while installing package 'defaults::openssl-1.1.1b-he774522_1'.
PermissionError(13, 'Permission denied')
Attempting to roll back.
Rolling back transaction: done
[Errno 13] Permission denied: 'C:\\Users\\eweli\\Anaconda3\\envs\\HAABSA\\Library\\bin\\libssl-1_1-x64.dll'
I managed to solve this by going to the directory where the file libssl-1_1-x64.dll is located (in your case, C:\Users\eweli\Anaconda3\envs\HAABSA\Library\bin\). Then, I removed the file (by cutting and pasting it to the desktop, just to be safe) and ran the installation command again in an Anaconda prompt (with admin rights):
conda install -c anaconda spyder
After that, the installation went smoothly and a new version of libssl-1_1-x64.dll was created in the corresponding directory (thus I deleted the one I moved previously).
To install spyder, go to the command line and to the directory where you work. Activate your virtual environment by typing
conda activate environment_name
Then once that returns just type
conda install spyder
This should install spyder in your virtual environment.
I had the same issue today, and weirdly a lot of versions didn't work out for me. However, what worked was to go to anaconda prompt, activate the environment and then type
conda install -c conda-forge spyder
Go the directory of your environement in terminal and type :
conda install -c anaconda spyder
it worked well for me.

Spyder crashing after installing Keras through Conda

I downloaded Anaconda on a PC. I would like to use TensorFlow and Keras. I know I have to use Python 3.6 and TensorFlow 1.0.9 (because of my code).
After installing Anaconda, I open my Anaconda prompt (in admin) and I put these instructions to create a new env:
conda create --name deeplearningaz python=3.6 anaconda
activate deeplearningaz
conda install theano
conda install tensorflow
conda install keras
conda update --all
I don't have any errors, but a warning about updating Conda version, and a few debug messages.
After that, I try to check if I'm using the correct version of Python, so I type (still in Anaconda prompt) and import keras (to see if it's ok):
python
import keras
Everything works perfectly fine.
Then I type quit() and type spyder (to open the Spyder from the env in Python 3.6).
Spyder opens, and if I type anything (import pandas, numpy et read a csv), then it crashes... for no reason (and no error).
After that, still in the Anaconda prompt, I try again to open Spyder and I get an error:
I don't get the problem, I try again and again to uninstall and install anaconda (and checking if my file was really delete). I didn't find...
I check the print(sys.path) and it looks like it's ok (but I don't see the env).
Does anybody have any idea?
I put here the conda info in the env (before the crash).
I don't use Spyder, but based on this discussion about how they don't really support switching conda envs yet, it sounds like currently the correct way to get Spyder to use a Conda env is to launch Spyder from outside the env, and then change the Python interpreter (Tools > Preferences > Python Interpreter) to point to the python located inside the env you wish to use.
Or if you really don't care about space, simply install a new Spyder instance in the env (conda install -n deeplearningaz spyder), and then you should be able to launch within the env without issue.

I am not able to install scikit-image package from anaconda

conda install scikit-image
I used this command in anaconda prompt to install this library but I am getting an error
I have set the environment variable as my jupyter notbook is working properly.
You need to open the anaconda prompt. Go to the Windows start icon, start typing "Anaconda", select "Anaconda prompt". A new command window opens. Now you can use conda from there.

pip not working in python 3.5 on Windows 7

I have installed python 3.5 on my Windows 7 machine. When I installed it, I marked the check box to install pip. After the installation, I wanted to check whether pip was working, so I typed pip on the command line and hit enter, but did not respond. The cursor blinks but it does not display anything.
Please help.
Regards.
Add the Script folder of python to your environment path
or you can do this from command line:
python -m pip install package-name
go the windows cmd prompt
go to the python directory
then type python -m pip install package-name
run it at the cmd window, not inside the python window. it took me forever to realize my mistake.
I was having the same problem on Windows 10, This is how I fix it:
Click the search icon and type System Environment
In System Properties click on Environment Variables
In System Variables tab click New
Enter PYTHON3_SCRIPTS for the variable name and C:\Users\YOUR USER NAME\AppData\Local\Programs\Python\Python38-32\Scripts for Variable Value. Don't forget to change (YOUR USER NAME) in the path with your user, And to change your Python version or just go to this path to check it C:\Users\YOUR USER NAME\AppData\Local\Programs\Python
Click OK
Click NEW again!
Enter PYTHON3_HOME for the variable name and C:\Users\YOUR USER NAME\AppData\Local\Programs\Python\Python38-32\ for Variable Value. Don't forget to change (YOUR USER NAME) in the path with your user, And to change your Python version or just go to this path to check it C:\Users\YOUR USER NAME\AppData\Local\Programs\Python
Click OK
Find Path in the same tab select it and click Edit
Click New and type %PYTHON3_SCRIPTS% Then click OK
Now, everything is set. Restart your Terminal and pip should be working now.
I had the same problem with Version 3.5.2.
Have you tried py.exe -m install package-name? This worked for me.
As soon as you open a command prompt, use:
python -m pip install --upgrade pip
then
python -m pip install <<package-name>>
If you are working in Pycharm, an easy way is go to file>setting>project interpreter. Click on the + icon you will find on right side probably and then search and install required library.
For those with several python versions of python 3 installed in windows: I solved this issue by executing the pip install command directly from my python35 Scripts folder in cmd...for some reason pip3 pointed to python 34 even though python 35 was set first in environmental variables.
I had the issue, and answered this same question sometimes ago. Do open a cmd if in windows OS or linux OS with admistrative privilege. Then python -m pip install --upgrade pip
then
python -m pip install <>
Working on windows and above version than 3.0
First upgrade pip to pip3 by following command:
pip3 install --upgrade setuptools pip
Then install maximum package by following command:
pip3 install <package_name>
I never wrote all package because some package not support to pip or pip3 command.

Resources