I'm trying to import a module (batman, for model transits) in jupyter notebook, but its telling me file not found. However when I use the anaconda terminal it imports without issues
This is the error I get from Jupyter Notebook
I've tried reinstalling the package, and I've tried to find a kernel in which it works, but I'm not sure how to go about that
any help is appreciated
Try checking if the module installed properly by running this:
python -c 'import batman; batman.test()'
the batman module also seems to have some issues when installing on windows.
Read this github if you're on windows https://github.com/lkreidberg/batman/issues/26
I've faced the same issue when I use Jupyter in an Anaconda environment. Jupyter Notebook doesn't use the same kernel as Anaconda and I had to specify it manually.
What you can do is comparing the Python version on your Anaconda environment by running this command in your shell:
python --version
And in your Notebook :
import sys
print(sys.version)
Are the versions different ? If so, you must add your Anaconda kernel to your Notebook :
ipython kernel install --name "local-anaconda-env" --user
Then select it in your Notebook.
I was facing the same issue in VSC. What I did is that first I moved the folder(In your case batman) to where VSC had been installed on my laptop. Then I changed the default directory to where VSC was installed on my laptop by running the following code in VSC.
import os
os.chdir("The path where VSC is installed")
Also If you could try to do the code in a python file instead of jupyter notebook
In a cell within your notebook run the following:
%pip install batman-package
Based on here.
And the use of modern pip install magic to handle installing to correct enviornment from inside a notebook, see here.
For others, hitting here and not seeing what they want/expect.
Above is for batman:
Bad-Ass Transit Model cAlculatioN. Associated Github Repo is here, and Python Package Index page.
This is a poor name for a package as at least three developers have claimed this. Also see:
Anaconda install for Batman at conda-forgeBayesian Analysis Tool for Modelling and uncertAinty quaNtification
BATMAN: A Python deployment toolbelt -Batman 0.7.0 at the Python Package Index
Maybe those links will help you.
Related
My FreeCAD software runs on Windows 10. Its built-in Python console uses Python 3.8. In order to import its modules to an external Python, I created a Python3.8 environment in anaconda and the module can be successfully imported with Jupyter QtConsole. However, import errors show up when I do the same thing in Spyder. Does anyone have a similar problem? Any idea what is going on here? (see the images below)
successful import in Jupyter QtConsole
Failed import in Spyder
I uninstall the Freecad program and use ananconda to reinstall the Freecad package. Now the Spyder works fine.
FYI: Use the following command (I copied from the wiki page) to do the installation: "conda create --name fcenv --channel conda-forge freecad"
Creating a new environment seems to be necessary. Otherwise, the installation will fail.
I can import Tornado in my Jupyter Notebook without any problem but when I try to do so in VS Code I get the following error ModuleNotFoundError: No module named 'tornado'.
I installed Tornado using Anaconda, conda install -c conda-forge tornado, but I don't know how that could make a difference between Jupyter and VS Code. Any ideas how I can get Tornado running on VSC?
You need to select correct python interpreter in visual studio code, Below link might be helpful in selecting the correct python interpreter for your code.
https://code.visualstudio.com/docs/python/environments
Also, I believe you should use virtual environments for managing the package efficiently, to integrate the right virtual environment in Jupiter notebook
you can follow this https://www.slideshare.net/dhineshsunderganapathi/intro-tovenvpy3?qid=8f764e4a-12d4-4280-841f-e4314afcd7ab&v=&b=&from_search=1
Let me know how this goes.
I am on Windows Subsystem for Linux (WSL). I've defined an environment and I am trying to add the palettable package to it. This is what I tried:
conda install palettable, went fine no errors, tried to do import palettable in my script and I get the error ModuleNotFoundError: No module named 'palettable'
Next I did conda remove palettable
Then I installed again, this time using pip by doing pip install palettable
I get the same error
Did I miss a step? Or do something wrong?
I've added many other packages to this same environment using conda and not had any problems or encountered this error before.
You can easily fix this problem by restarting the kernel or IDE in which you are writing the code after installing the module..
I found the problem. I am using VSCode and I didn't realize the python interpreter and the notebook kernel are set independently. The interpreter correctly reflected that I was using my project environment. But the notebook kernel (top right corner of NB window) was not set to the same thing. Once I set it correctly and restarted the IDE it now is correctly finding the packages.
I have created a different environment for python 3.6.7 32-bit Windows for pyenchant. I have done pip install pyenchant. It was successfully installed. From the command prompt I am able to import the library and also run the example. But when from the same environment, I load the jupyter notebook, and try to import enchant but it gives error : ModuleNotFoundError: No module named 'enchant'. I have wasted a lot of time trying to fix it. Any leads appreciated.
Maintainer have gave up on supporting pyenchant for windows x64 + python3.5 (here).
The only thing you can do there right now is to try to build it yourself. Or maybe wait until someone steps up as a maintainer of that library.
Here is supporting doc issue for the same:
https://github.com/kivy/kivy/issues/5816
Hope it helps.
I am trying to use PyQ in Jupyter, a package designed to communicate between the Python and Q/kdb+ programming language. I am successfully able to install Q/kdb+ on my Windows computer (where the q.exe file is located in the standard C:), pip installed pyq, and opened Jupyter with Anaconda Navigator. However, when I create a new .ipynb notebook and attempted to initialize Q using PyQ, I am presented with:
ImportError: Importing pyq from stock python is not supported. Run path\to\q.exe python.q.
How do I fix this problem? Thank you!
You need to install pyq-kernel.
Please see Installing Jupyter Kernel for details.