How to install rdkit library in my jupyter notebook. I am using Anaconda environment.
Inside the anaconda environment, just run conda install -c conda-forge rdkit
You can find detailed installation instructions here.
Related
Trying to get OSMnx into jupyter conda environment.
But conda environment not set correctly.
On command line:
Created conda environment using OSMnx installation steps
I cloned the environment to rename it 'realestate'
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
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
I followed the installation of the xeus-cling (created an env, activated,installed xeus-cling there) and when I want to select the C++14 kernel in a jupyter notebook it only appears Python3. What am I doing wrong?
I had the same problem. Its because jupyter-notebook is not installed in your environment. The jupyter server which is starting is the global one hence you don't see the c++14 option. The solution is:
Create a new directory and git clone the repository.
Run the conda env create -f environmental.yml command in cmd.
Run the conda activate xeus-cling command.
Run the jupyter notebook command.
You should now be able to see the c++14 and c++17 options. Step 2 created the xeus-cling environment and installs all the correct package versions including the correct jupyter notebook version.
Install notebook in your environment.
conda install xeus-cling notebook -c QuantStack -c conda-forge
You need register new kernels in jupyter:
jupyter kernelspec install PREFIX/share/jupyter/xcpp11 --sys-prefix
jupyter kernelspec install PREFIX/share/jupyter/xcpp14 --sys-prefix
jupyter kernelspec install PREFIX/share/jupyter/xcpp17 --sys-prefix
I am not able to link Jupyter kernels to their parent Conda environments. After creating a new kernel linked to Conda environment, I'm getting a different version of Python and its dependencies inside Jupyter lab.
Here are the steps I followed:
Created a conda environment using:
conda create -n nlp python=3.6
conda activate nlp
(nlp) ➜ ~ python --version
Python 3.6.9 :: Anaconda, Inc.
(nlp) ➜ ~ which python
/anaconda3/envs/nlp/bin/python
Inside the environment I created a Jupyter kernel with:
(nlp) ➜ ~ python -m ipykernel install --user --name=nlp
Installed kernelspec nlp in /Users//Library/Jupyter/kernels/nlp
Investigating the created json file for the kernel:
(nlp) ➜ ~ cat /Users/<username>/Library/Jupyter/kernels/nlp/kernel.json
{
"argv": [
"/anaconda3/envs/nlp/bin/python",
"-m",
"ipykernel_launcher",
"-f",
"{connection_file}"
],
"display_name": "nlp",
"language": "python"
}%
It seems to be pointing to the environment version of Python
But when I start Jupyter Lab and select the nlp kernel, I get a different version of Python and some dependencies are missing
!python --version
Python 3.5.6 :: Anaconda, Inc.
!which python
/anaconda3/bin/python
Could you please try the following steps:
conda activate nlp
conda install ipykernel
ipython kernel install --name nlp --user
After these steps please try changing the kernel again in jupyter lab to "nlp".
Thanks.
this behavior is actually normal in Jupyter lab.
If you run
import sys
print(sys.version)
!python --version
in a notebook, the print statement will give you the Python version of the conda env, while the second will give you the Python version of your base env.
The easiest workaround for this is to simply pip install jupyterlab in your conda env and then run jupyter lab in your conda env. Then, there will not be a mismatch in Python versions between the new "base" env and the conda env which will help clear up any DLL problems.
It's probably not best practice, but you do what you gotta do when working with legacy code, ig.
Can you try this :
# in base env
conda install nb_conda_kernels
conda activate nlp
conda install ipykernel
conda install ipywidgets
# install kernelspec
python -m ipykernel install --user --name nlp --display-name "nlp env"
When you run jupyter notebook, you will see 2 nlp kernels. Use the one with "Python [conda:env:nlp]"
Today I'm setting up an R environment in Anaconda on my Linux machine. The goal is to run a specfic version of R that can handle the dependencies of a bioinformatics pipeline.
So far, I have:
downloaded and installed Anaconda (v 4.5.4), and created and activated an environment for R:
conda create --name r_3.5.1
conda activate r_3.5.1
Searched for and downloaded a specific version of R and R-essentials in the activated environment:
conda search r-base
conda install -c conda-forge r=3.5.1
conda search r-essentials
conda install -c r r-essentials=3.5.1
However, when I open a jupyter-notebook while in this environment, start a new R notebook, and check the version, I'm running version 3.2.3. This old version appears to be what's in my /usr/bin/r, while the R version I want is in /home/me/anaconda3/envs/r_3.5.1
How can I specify that when I open or create a jupyter-notebook for R in a particular environment, that it opens with the specific version of R I want?
Opening a Jupyter notebook in the environment was not sufficient to begin using the specified version of R.
To fix the problem, I installed jupyter while in my environment:
conda install jupyter
Then I opened a prexisting jupyter notebook that had previously been using the wrong R kernel, and ran in a cell:
install.packages('IRkernel')
IRkernel::installspec()
and confirmed with version in a different cell that I was running the correct version.
After many different ways of trying to install jupyter, it does not seem to install correctly.
May be MacOS related based on how many MacOS system python issues I've been having recently
pip install jupyter --user
Seems to install correctly
But then jupyter is not found
where jupyter
jupyter not found
Not found
Trying another install method found on SO
pip install --upgrade notebook
Seems to install correctly
jupyter is still not found
where pip /usr/local/bin/pip
What can I do to get the command line jupyter notebook command working as in the first step here: https://jupyter.readthedocs.io/en/latest/running.html#running
Short answer: Use python -m notebook
After updating to OS Catalina, I installed a brewed python: brew install python.
It symlinks the Python3, but not the python command, so I added to my $PATH variable the following:
/usr/local/opt/python/libexec/bin
to make the brew python the default python command (don't use system python, and now python2.7 is deprecated). python -m pip install jupyter works, and I can find the jupyter files in ~/Library/Python/3.7/bin/, but the tutorial command of jupyter notebook doesn't work. Instead I just run python -m notebook.
My MacOS has python 2.7, I installed python3 with brew, then the following commands work for me
brew install python3
brew link --overwrite python
pip3 install ipython
python3 -m pip install jupyter
You need to add the local python install directory to your path. Apparently this is not done by default on MacOS.
Try:
export PATH="$HOME/Library/Python/<version number>/bin:$PATH"
and/or add it to your ~/.bashrc.
Try solving this with Conda or Poetry.
Poetry makes it a lot easier to manage Python dependencies (including Jupyter) and build a virtual environment.
Here are the steps to adding Jupyter to a project:
Run poetry add pandas jupyter ipykernel to add the dependency
Run poetry shell to create a shell within the virtual environment
Run jupyter notebook to to fire up a notebook with access to all the virtual environment dependencies
The other suggested solutions are just band-aids. Conda / Poetry can give you a sustainable solution that's easy to maintain and will shield you from constant Python dependency hell.