Using PyQ in Jupyter Notebook - python

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.

Related

Why can I not import a module (Batman) in Jupyter Notebook

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.

FreeCAD import error while using Spyder "ImportError: DLL load failed while importing FreeCAD: The specified procedure could not be found."

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.

Error running jupyterlab via pip install in python 3.9

Hello I am fairly new to Python and I'm trying to get started with data visualization. I pip installed jupyter lab but it gave the error of jupyter-troubleshoot.exe and jupyter.exe are installed in 'C:\Users\myusername\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p which is not on PATH. I have had problems in the past with accessing csv files using VSCode so I think there might be an issue with my directory. How do I change this to PATH so the jupyterlab runs?
Thank you!

Tornado will import in Jupyter but not VS Code

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.

Anaconda and Python Shell

I am a newbie, was trying to install OpenCV, I used this video for reference-
https://www.youtube.com/watch?v=3xAslL8htuQ
And in the beginning of the video, it was said that python and numpy are prerequisites.
Then I opened command prompt on my Windows 10 and typed-
pip list
So I tried importing numpy on command prompt-
Opened jupyter notebook through Anaconda navigator-
Experts, I don't understand how is Anaconda related to my command prompt. I got "Anaconda" installed on my Windows 10 in a workshop on "Data Analytics". But I don't understand that why can't I import numpy on a Python Shell/IDLE, just like I import it on my command prompt or jupyter notebook. And does pip list only show packages which I can import on command prompt and jupyter notebook but not on Python Shell? Is my Python Shell completely independent of pip list, and Anaconda? If I want to import numpy on IDLE, would I have to install it again? And as I want to learn OpenCV for image processing, should I install OpenCV using pip and then I would be able to import it on my jupyter notebook or command prompt but not on Python IDLE? Is it like Python Shell/IDLE only for normal Python programming but not for using python libraries like tensorflow/numpy/opencv for "Data Analysis"?
Please help. Would mean a lot. My doubts might be really silly because I don't have much knowledge about Anaconda and pip. Thank you.
You can do pip install opencv-contrib-python. Or you can download a pre-compiled whl file for Windows from here.

Categories

Resources