Anaconda prompt not displaying (base) environment, displays path instead - anaconda

I just did a more or less clean install of Miniconda3-latest-Windows-x86_64.exe. I selected the "All users" option to avoid admin rights problems with packages such as jupyter. The program was installed into C:\ProgramData\Anaconda3.
When I open the Anaconda prompt, conda returns the following output, however it doesn't recognize the base environment the way I would like it to, instead I get this on my prompt:
(C:\ProgramData\Anaconda3) C:\Users\aboufira>
When I really expect this:
(base) C:\Users\aboufira>
I find this problem to be quite annoying. Why does this occur? Have I installed into the wrong directory? How can I get it to display base like it should?

Delete your .condarc-file located at C:/Users/User and restart navigator again - worked for me :)

Related

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.

ModuleNotFoundError Despite Installing with pip

mac os Catalina, python3.8.2
Hey All,
I know there are similar questions about this, but they didn't seem to help me. I installed a module (quandl) using pip3.8 install. Then I try to import quandl in a .py file and get a ModuleNotFoundError. I do have multiple versions of python installed, can't figure out how to get rid of them safely, hence why I used pip3.8 install to make sure it points to the write place. Still no dice. I am not using a venv.
From the terminal, this is the pip3.8 install path: /usr/local/lib/python3.8/site-packages
From the .py file via VScode, I am interpreting using: /usr/local/bin/python3.8
Can someone educate me on what I am doing wrong?
I was previously interpreting from /Library/Frameworks/Python.framework/Versions/3.8/bin/python3, but I noticed pip was not installing there.
At the bottom of your VSCode window, there's an orange status bar. Starting at the far left, you'll see your git repo info, the git status, and then the Python environment you're using. If you click that, VSCode will slide in a modal dialog window that'll let you choose your python environment -- my VSCode defaulted to /usr/bin/python3, but my pip3 (and python3) are in /usr/local/bin. Once I picked the correct interpreter, I stopped getting the ModuleNotFoundError

How to compile GCC on macOS Catalina? [duplicate]

I previously had Conda running smoothly on Mojave, but I've found that the upgrade to Catalina moves the "anaconda3" folder to your Desktop > Relocated Items > Security > anaconda3. It seems Catalina's security settings may not allow applications to install directly under the user directory anymore.
I tried the suggestion here, written below:
Hi, I might have a solution
Copy the folder anaconda3 located in Relocated Items to /Users/myname/
Open Terminal
Enter: export PATH=''/Users/myname/anaconda3/bin:$PATH"
Enter: conda init zsh
It worked! Good luck!
But this doesn't work for me. After conda init zsh I get:
-bash: /Users/USER/anaconda3/bin/conda: /anaconda3/bin/python: bad interpreter: No such file or directory
How can I get Conda up and running again without losing all my virtual environments? Thanks!
Update
I got Conda to work following #Ted Shaowang's suggestion. This means that conda env list shows all the virtual environments created via Conda.
However I am still experiencing an issue with virtualenv as since I changed the default anaconda3 file locations, python cannot be found.
The python executable located at .virtualenvs/env/bin/python cannot be found. Do I need to make further changes in order for python to work from virtualenv too?
I have the exact same problem and this works for me:
After you move anaconda from "Relocated Items" to ~/anaconda3, edit the first line of ~/anaconda3/bin/conda file from #!/anaconda3/bin/python to #!/Users/USERNAME/anaconda3/bin/python to reflect the change.
I would probably abstain from using the above solution. That ~/anaconda3/bin directory has lots of runnables (not just the conda one) that would need to be altered in this manual way. For example, unless you make the same change you cannot run jupyter notebook either, neither from base nor from other envs you might have.
My tip: Try getting a requirements file for your virtual envs, and do a fresh installation. You could use pipreqs to get the requirements used for individual projects: https://www.idiotinside.com/2015/05/10/python-auto-generate-requirements-txt/
No solution will be completely working without fixing the baked-in hard-coded prefix entries in files. There's a longer description and a recommended fix at https://www.anaconda.com/how-to-restore-anaconda-after-macos-catalina-update/
Technically this is reinstalling anaconda, however, I restored all my conda envs so, hopefully this is an acceptable solution!
Here is how I got it working on Catalina as of a few minutes ago (now using z-shell):
- Verified the existence of "Relocated Items" directory on my desktop and the "anaconda3" directory and its contents inside
- Navigated into the envs directory under "anaconda3" and left the finder window open (see screenshot)
THEN:
opened new Terminal (z-shell)
ran (this installed to /usr/local/anaconda3):
brew cask install anaconda
after installation was successful I opened my ~/.zshrc file (for my z-shell aliases) and added the following line:
export PATH="/usr/local/anaconda3/bin:$PATH"
saved my ~/.zshrc file, then reloaded with:
source ~/.zshrc
to verify conda command works now, I ran:
conda env list
for me, this showed a base env and that was it
then open Finder to the new envs location:
open /usr/local/anaconda3/envs/.
I dragged (moved) all my old envs into the new envs folder, and then ran:
conda env list
And all my old envs are back! :)
updated my PyCharm interpreter / env paths to reflect the new locations of these envs (had to restart PyCharm after, but now it works!)
DONE
Unsure whether this is considered a comment or at least a temporary answer, but I would refrain from attempting to fix any Catalina compatibility issues with Anaconda for now. See this GitHub issue.
I have the same problem, and this work for me :
My solution:
Copy your anaconda3 from Relocated Items folder
Paste in User/YourUserName
Open conda file in anaconda3/bin with the editor and edit the first line #!/anaconda3/bin/python to #!/Users/YourUserName/anaconda3/bin/python
Save it and run conda file
Open Terminal
Run this : export PATH=''/Users/YourUserName/anaconda3/bin:$PATH"
Run conda init zsh
I had incurred the same issue, and the following solution worked for me, and this is the easiest solution:
Instead of messing around copying the anaconda3 file from relocated items into User/USERNAME directory, better would be just to reinstall anaconda navigator's latest version from its official website : https://www.anaconda.com/distribution/#macos
While installation, it will ask you some permissions which are a result of new Apple Security Policies, just grant them, and it works just the way it should after this fresh installation!
This is what worked for me.
These are my header files (Catalina 10.15):
/Library/Developer/CommandLineTools/usr/include/c++/v1/stdio.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/sys/stdio.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/stdio.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/sys/stdio.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/sys/stdio.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/stdio.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/sys/stdio.h
Run sudo find /Library -name stdio.h to see where yours are located.
Mojave 10.14 header files:
$ sudo find /Library -name stdio.h
/Library/Developer/CommandLineTools/usr/include/c++/v1/stdio.h
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/stdio.h
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/stdio.h
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/sys/stdio.h
As can be seen the SDKs are now split into MACOSX10.14 and 10.15 unlike in Mojave.
TLDR
So, these were my SDK folders on Catalina:
Rename MacOSX.sdk to MacOSX_orig.sdk
Right click on MacOSX10.14.sdk
Duplicate
Rename duplicate folder to MacOSX.sdk
Your folder structure should now look like this:
Like this we are basically using the previous version's OSX sdk as sysroot. Hope this helps.

How to open a Jupyter notebook on a Mac?

Maybe this does not work at all, because its a Mac, but maybe there is a way to open a jupyter notebook on a Mac? I tried the following command
jupyter notebook Manager.ipynb
and I got an error
Error executing Jupyter command 'notebook': [Errno 2] No such file or directory. Same with out 'notebook':
jupyter Manager.ipynb
Error executing Jupyter command 'Manager.ipynb': [Errno 2] No such file or directory
There is a file named Manager.ipynb in the current folder.
So is there a way to open that notebook on a Mac? Do I have to install some crazy stuff in order to make it work?
The problem I was facing was either a mis-installation of jupyter, or there is another application on Macs with the same name. However, (re)install it with this command
pip install --user jupyter
(a global pip install does not seem to work because of some Mac-nonsense, see here), and then it might work. Or install it in a virtual environment altogether.
This may or may not be helpful for you, but it's something to know and it's how I access the notebook on my mac.
When I installed Julia, it just came with the command line, I never got the icon to open the notebook or anything of that nature. I had too much trouble trying to install it so I just gave up on getting the icon or a direct link, but if you get Julia installed, you should be able to access the terminal version by entering
$ Julia
Or clicking on the Julia terminal icon, which will give you this:
And then you can just open the notebook by running the following:
using IJulia
IJulia.notebook()
Also if you're just starting with Julia don't forget you may have to add the package manager by typing using Pkg or adding it directly to your code.
This should open it in your default browser (there is no option to open it in a different browser or window). I'm not sure if this is useful but it's an option for those who have trouble installing it like I did.

Can't get pip working with psychopy install

I am very new to python and plan to use psychopy quite a lot. I am on a work computer but have full admin rights.
Psychopy came with python version 2.7.11 and includes setuptools already.
I am trying to install the selenium module, but having trouble getting pip to work at all.
In cmd, it is recognising the 'python' command, so I know python is in my path.
I get the message "can't open file 'pip': [Errno2] No such file or directory" from:
python pip install selenium
I get " 'pip' is not recognised as an internal or external command" from:
pip install selenium
When I change directory to where pip is located, I get:
Fatal error in launcher: Unable to create process using '"'
Using pip2 makes no difference.
It seems a simple thing but where am I going wrong with this?!
I never really got to the bottom of this, but this is what I found out and here are the commands that worked for me in Windows. Be aware that I am far from expert!
To run python scripts (*.py) from command line (cmd) then C:\PsychoPy2 and C:\PsychoPy2\DLLs need to be in path. ('Path' contains directories or file extensions that can be more globally accessed, i.e. do not require you to change the prompt to the relevant directories first).
To check, open cmd and either type echo %PATH% or just type python. (If python starts, the line will say >>>. You can exit by typing quit())
To add to path, get properties of computer, then advanced system settings, then environment variables.
To check pip.exe (a sort of installation wizard) is installed, either search for the file, or check C:\PsychoPy2\Scripts for it. This may also need to be in path.
To reinstall the latest versions of pip and setup tools, I went to cmd and typed:
python -m pip install -U pip setuptools
If the same code did not work for other modules (which in my case was due to network access), then I downloaded the wheel file (*.whl) for that module (from their website) and ran the following code:
python -m pip install c:/modulename.whl
These may not be the correct ways of doing things, but they worked for me when I couldn't get other ways to work!
I've just had the exact same issue with the pip install, and a conflict with PsychoPy installations. I think it's because python automatically wants to call on the path that's been set by Psychopy, so it can't get to the 'pip' folders that for me, remain in a temporary/hidden file. This wasn't intuitive for me - on any machine without psychopy python just 'works' when you download it.

Resources