adding conda environment via cmd line to jupyter doesn't work

北城以北 提交于 2021-01-29 06:02:06

问题


Trying to get OSMnx into jupyter conda environment. But conda environment not set correctly.

On command line:

  1. Created conda environment using OSMnx installation steps
  2. I cloned the environment to rename it 'realestate'
  3. Added realestate to Jupyter:
> conda activate realestate
> conda install -c anaconda ipykernel
> python -m ipykernel install --user --name=realestate
> which python
/opt/anaconda3/envs/realestate/bin/python

On Jupyter the realestate environment shows up... but when I run

!which python

I get

/opt/anaconda3/bin/python

I've created some conda environments inside of Jupyter(Conda) and they show up as

Python [conda env: otherenv]

that then produces right path

!which python
/opt/anaconda3/envs/otherenv/bin/python

What am I missing?

PS. OSMnx install is not a simple conda install

conda config --prepend channels conda-forge
conda create -n ox --strict-channel-priority osmnx

回答1:


From what I can tell, it sounds like you're trying to have OSMnx, Jupyter, and all the packages in the anaconda metapackage installed together in a single conda environment. If so, just create the conda environment with all those packages in one line, then install the ipython kernelspec in it:

conda config --prepend channels conda-forge
conda create -n realestate --strict-channel-priority osmnx anaconda jupyter
conda activate realestate
python -m ipykernel install --sys-prefix --name realestate --display-name "Python (realestate)"
jupyter kernelspec list


来源:https://stackoverflow.com/questions/63315662/adding-conda-environment-via-cmd-line-to-jupyter-doesnt-work

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!