I'm trying to import the Tensorflow module in my Jupyter notebook in a conda environment, but I get the following error:
AttributeError: type object 'h5py.h5.H5PYConfig' has no attribute '__reduce_cython__'
However, if I open Anaconda Prompt, activate the same enviroment and import tensorflow in the shell, it does work.
Versions:
tensorflow-gpu: 2.2
h5py: 2.10
I tried downgrading to different versions (h5py 2.7 and tf-gpu 2.1), but that resulted in a lot more errors of conflicting versions of packages.
Does anyone have an idea why Jupyter is not loading the module and why it is working within the Anaconda shell?
Thanks
Your jupyter notebook is probably running from the base environment. This can happen if jupyter notebook is installed in base but not in your current env.
Open Anaconda Navigator with anaconda-navigator, navigate to Environments and active your env, navigate to Home and install jupyter notebook, then lunch jupyter notebook from the navigator.
After doing this for the first time, you can just do:
source activate your_env
jupyter-notebook
the next time.
Also you can check the python running inside jupyter with command:
!which python
Related
Python is installed in Linux, as shown in terminal, but why does jupyter notebook on vscode always say not Python is installed?
Thanks a lot.
Have you selected a python environment which has jupyter notebook installed.
Install jupyter notebook in environment:
pip install jupyter notebook
Select environment in VSCode:
https://code.visualstudio.com/docs/python/environments#_select-and-activate-an-environment
I'm using Ubuntu, installed Vs Code and anaconda. I've also installed python extension in VS Code, which brings Jupyter Notebook extension. Now, whenever I'm trying to run code from the Jupyter extension, its throwing error as if it requires ipykernel.
Now, my conda 'base' environment has already ipykernel. Why cant Jupyter extension look for ipykernel from the current activated environment?
Is there any explicit settings to be made, to make VS Code Jupyter extension use ipykernel from the current active environment? Please provide it.
Click here to switch the environment of Jupyter Notebook.
Possible solution python -m ipykernel install --user --name=conda_env_name
I cannot use arcgis package in Jupyter notebook in browser.
I created a virtual environment in Conda, myenv38:
I used Conda install to install arcgis package, so it is in the virtual environment.
However, when I launch Jupyter Notebook from this environment, and select myenv38 as a kernel, arcgis returns ModuleNotFoundError: No module named 'arcgis'.
When I use import sys sys.executable in the iPynb file of the question, it shows a different path ('/Users/myname/.pyenv/versions/3.9.0/bin/python'). This is apparently weird because the virtual environment is configured with python 3.8 to make it compatible with the arcgis.
This doesn't happen in VScode, but I can't use it because the map doesn't show in it.
Do you have any suggestions?
I am trying to follow the TensorFlow API documentation. I have done all the steps and activated my tensorflow_gpu environment. In the C:\TensorFlow\models\research\object_detection I typed "jupyter notebook" and it opens me a blank page http://localhost:8889/tree.
I tried to open the Jupyter Notebook in my base(root) and it opens the dashboard but for the other environments it only gives me a blank page.
How can I avoid that? Thank you.
I tried to delete and re-install jupyter notebook for that specific environments. I tried to upgrade and downgrade the version of it. Nothing worked yet.
You can still run the Jupyter Notebook in your base environment and make the notebook run with a different kernel (like if you are running the notebook in a different environment). In order to do so you need to install these packages in all of your environment:
conda install nb_conda nb_conda_kernels ipykernel
By doing so you will be able to see the kernels of all of your environments directly in base.
You will be able to start jupyter notebook in base, and once the notebook is running in your browser you can decide which kernel to use.
In the above picture I started Jupyter Notebook in my base environment, and having installed those packages in all the environments let me run any notebook with any kernel.
NB: My other environments are tf_lite1.13, tf_lite2, tf_night. Root will run the base kernel.
I created conda Python3.6 environment called betting.
Next activated the env with source activate betting
I run pip install betfairlightweight for the package.
Running pip list tells package is installed, but notebook fails to import the package with error > ModuleNotFoundError: No module named 'betfairlightweight'
Based on StackOverflow question 36382508
I installed ipykernel to this environment. Stopped and ran jupyter notebook from this env. However it seems that it does not solve my issue. I also tried to install notebook to this env, but import still fails to find module.
I added the same conda betting envaroment to PyCharm and importing betfairlightweight works fine. So this is clearly linked to notebook.
Next in notebook, I run >
import sys
print(sys.executable)
Seems that my notebook is running from anaconda root, which explains why it cannot find the package. How do change from which env notebook runs? I am already on that env. Do I need to run jupyter from absolute path or something?