I know normally I can just do . ~/anaconda3/etc/profile.d/conda.sh to use conda command if anaconda directory is directly under home/; but I need to put my anaconda in another folder which is shared across the servers, so my conda path is now /home/user/sharedfodler/anaconda3 instead. Now if I do . ~/anaconda3/etc/profile.d/conda.sh then try to use conda command, I get the following error:
/bin/sh: 34: /home/user/anaconda3/bin/conda: not found
it seems the system doesn't recognize anaconda that isn't directly installed under home directory. What should I do in this case?
Related
I have a fully working virtual environment installed on my Linux machine.
This venv can be regularly used by the terminal in VS code calling source /mypath/venv/bin/activate.
The problem is that the Python interpreter in VS code cannot access any of the packages in the virtual environment, despite setting up the path on the interpreter as described in most of the guides.
I decided to manually set up the path in the settings.json file inside the .vscode folder as follows:
{
"python.pythonPath": "/mypath/venv/bin/python3.8"
}
venv is still not accessible through the interpreter. Any other suggestions?
I will answer my own question.
Turned out my pip installation was pointing to a path (standard /home/username/.local/bin/pip) which was different from my venv directory (/my_path/venv/bin/pip).
You can display the path by executing the command which pip.
In my very specific case, there was some mix-up when I first setup my Linux machine, meaning that venv only had a small amount of packages installed, while the directory containing the Python libraries and actually being used was the pip path. In other words, activating venv did not make any difference, since the Python libraries where loaded from the pip path.
So, first I had to ensure that pip had to point to the my venv folder, by modifying the .bashrc file in /home/username/, replacing
export PYTHONPATH=/home/username/.local/lib/python3.8
export PATH=/home/username/.local/bin:$PATH
with
export PYTHONPATH=/my_path/venv/lib/python3.8/
export PATH=/my_path/venv/bin:$PATH
All I had to do after was re-installing each of the required packages in the newer venv (generating a requirements.txt file from the older pip path helped).
Then I selected the venv path in the VS Code interpreter and everything is working fine now.
You actually do not need the settings.json file.
You could try to remove the .venv folder and create a new one by
python -m venv .env
It seems that vs code have changed something from .venv to .env. I'm not sure why.
After doing python -m venv .env open the terminal in vs code and it will active your .env.
You could (if you froze your pip installations) do a pip install -r requirements.txt and you are all good to go.
The default for the "python.envFile" setting is "${workspaceFolder}/.env" change it to "${workspaceFolder}/.venv" and restart vscode.
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?
When I tried to install Anaconda into my computer, the destination folder for my installation was "C:\Users\Lara Nguyen\Anaconda3". When I clicked "Next", there was a pop-up saying that "Error:'Destination folder' contains 1 space. This can cause problems with several Conda packages, and is thus disabled. Please install to a path without a space". After the installation, opened cmd and typed "Jupyter Notebook" but there was an error message saying that:"jupyter"is not recognised as an internal or external command, operable command or batch file.
Is there anyway I can fix this problem?
Looking at your path I am assuming you are using windows (I mention this so that other linux user do not refer this answer)
First of all it's clearly mentioned in the Anaconda installation documents that it is recommended to install to a path which does not have spaces
If you installed it correctly, did you register the anaconda path to the environment variable? If not then do that
The paths that you have to register will be something like this:
C:User\username\Anaconda3
C:User\username\Anaconda3\Scripts
C:User\username\Anaconda3\Library
Now run the anaconda prompt (not cmd) and just type the conda commmand
After typing the conda command if you did not get any error then you have successfully installed jupyter as well (You can cross check this by going to following location : C:User\username\Anaconda3\Scripts and searching for jupyter-script.py file)
now in anaconda prompt itself run the command jupyter notebook
if it still throws you error then I would strongly recommend you to reinstall Anaconda3 and follow the above steps correctly
I'm on Windows command line.
I installed Jupyter via pip 3.
I got this error, I suspect its path.
'jupyter' is not recognized as an internal or external command,
operable program or batch file.
However when I run
where jupyter
It returns:
INFO: Could not find files for the given pattern(s).
Does this mean Jupyter hasn't downloaded properly? Because it seemed to be fine when using the pip3 command.
Use the command py -m notebook and the problem is sloved.
When you are installing Anaconda ensure to check the check boxes to add the path to env. This worked for me.
It could have two reasons:
Either Anaconda is not installed in Windows.
Install it.
Path for Anaconda is not set in Environment variable.
Open Anaconda Command Prompt, search for "where conda".
Results:
C:\Users\<loremipsm>\AppData\Local\Continuum\anaconda2\Library\bin\conda.bat
C:\Users\<loremipsum>\AppData\Local\Continuum\anaconda2\Scripts\conda.exe
Use : Path as "C:\Users\<loremipsum>\AppData\Local\Continuum\anaconda2\Scripts"
**Path is a sample one, use you own.
I'm also new to Python, but this is what I found.
Try installing using Anaconda, check Add Anaconda to my PATH environment variable.
The reason is because if it's not checked, or if you use pip 3, paths are not automatically added.
You may also choose to manually add the path in Setting - Environment Variables.
You need to add path,where Anaconda is installed,in the Environment variable.
In my case it's
C:\Users\zahid\AppData\Local\Continuum\anaconda3\Library\bin
C:\Users\zahid\AppData\Local\Continuum\anaconda3\Scripts
Even I was stucked with the same issue.
What I did was I searched for the jupyter path in the Anaconda Prompt using the command "where jupyter"
After that I got a path
Then I went to my Environment variables(you would get this thing when you would search for the same) and then specified the new path there.
And the problem was solved.
Go to start and search for Anaconda Navigator
Launch the program
Then in Home section you will see Jupyter Notebook then click on Launch
Hope this helps