I have installed pythonnet to use clr package for a specific API, which only works with clr in python. Although in my python script (using command or regular .py files) it works without any issues, in jupyter notebook, import clr gives this error, ModuleNotFoundError: No module named 'clr'. Any idea how to address this issue?
Here is simple suggestion: compare sys.path in both cases and see the differences. Your ipython kernel in jupyter is probably searching in different directories than in normal python process.
since you are intended to use clr in jupyter, in jupyter cell, you could also
!pip install pythonnet for the first time and every later time if the vm is frequently nuked
Related
I'm now trying to run qiskit visualization functions(e.g. .draw() methods) in vscode.
I use latest version of Python, 3.11.1, and followed Getting Started Qiskit in here.
Also I installed qiskit extension in vscode.
However, when I run a qiskit code, the visualization functions don't work, even though code is compiled successfully.
I checked visualizing modules(mathplotlib, etc.) were installed.
I tried to re-install Python and vscode, including downgrading Python to 3.8. And it didn't work.
Additionally, qiskit-chemistry and qiskit-aqua installation warnings are pop-upped, but installation doesn't work.
I really don't know it is related on this problem, but I think maybe it's not since qiskit-aqua is deprecated.
The following screenshot is result of the qiskit test code.
result of running
draw() and plot_histogram() doesn't work as you can see.
How can I fix this problem?
These functions are meant to be used in Python Notebooks - they won't show up in normal .py files. Try using VSCode's Jupyter Notebook (.ipynb files) feature instead.
Currently I am working on a project with Jupyter Notebook in which I need to run a matlab script (.m) which includes a function that provides me with data which i try to solve with a tensorflow model afterwards. I can set up an environment that runs the matlab code an gives me the data and I can set up an environment that does the tensorflow thing but my problem is I can`t do it in the same environment.
Here is the setup and the problems. I am using matlab.engine which I installed like described here: https://de.mathworks.com/help/matlab/matlab_external/install-the-matlab-engine-for-python.html
To run my Jupyter Notebook I first navigate to the location where my python.exe and the matlab files are lying ("C:\Users\Philipp\AppData\Local\Programs\Python\Python37-32\Scripts"). If I try to run pip install tensorflow (in Anaconda Prompt) I got a lot of different errors like the following. Conda install works but even when it is installed i can`t import it.
ImportError: No module named 'tensorflow.core' or
ERROR: Could not find a version that satisfies the requirement tensorflow or just No module named 'tensorflow'
I searched for all those problems but nothing helped me. I think this has something to do with the directory I am working in and I know it is bad but I have no idea how to change that. The error also occurs in different environments.
Have you tried running !pip install tensorflow directly in Jupyter Notebook? It's a temporary workaround, but I am having the same problems and this one helped. Remember to comment it out after installation, so you wont re-run it by accident.
I found a solution to my problem. For this I needed a Jupyter Notebook and an external .py script that I design as a Flask. I can luckily run those in different environments. I past and request the data from the server by using "get" and "post".
If someone still has another idea to do all this in one JN, I would still be happy about answers.
I am new to Python and Jupyter notebook. I am using Windows 10.
I already installed Anaconda3 and tried to import cplex in Jupyter notebook environment.
But I only got the below error:
ModuleNotFoundError: No Module named 'cplex'
I did find some resolutions for that, but neither of them fixed the problem.
I think I have to set path or install something for using the CPLEX in Jupyetr notebook, but I cannot find how I do that.
You should have a look at https://www.ibm.com/support/knowledgecenter/SSSA5P_12.8.0/ilog.odms.cplex.help/CPLEX/GettingStarted/topics/set_up/Python_setup.html
You could use the Docplex api: http://ibmdecisionoptimization.github.io/docplex-doc/mp/getting_started_python.html
You could even start without installing cplex on your machine. (But call cplex in the cloud https://developer.ibm.com/docloud/try-docloud-free/)
And you could also use docplex in Watson Studio: https://dataplatform.cloud.ibm.com/docs/content/DO/DOcplex.html
I am trying to use a module from github called ffn and have downloaded it to my desktop. I am using Jupyter notebook for Python and was told i need to insert this code:
import sys
sys.path.insert(0, r"C:\Users\...\Desktop\ffn-master\ffn\_core_.py")
import ffn
..in order to use this code.
However when i run the subsequent lines of code that call functions from here I still get the error:
C:\ProgramData\Anaconda3\lib\site-packages\ffn\core.py:2054:
RuntimeWarning: invalid value encountered in minimum
negative_returns = np.minimum(returns, 0.)
I restarted the kernel and everything but still get the same error.
Can anyone help?
"The desktop module has the fixes that the installed module in the anaconda path does not." - It seems like you still have the original module installed in the anaconda library.
try running
conda uninstall ffn
and then include the entire library in the path in you notebook with
sys.path.append(os.path.abspath(r"C:\Users\...\Desktop\ffn-master\ffn\")
On my working PC (Windows7, no internet connection) there are two Pythons: one is the main (C:\Python36-32) with IDLE. Another - freshly installed Anaconda (C:\ProgramData\Anaconda3) - just for scipy and matplotlib (IT guy thought it is the best option).
So, matplotlib works only if I run my scripts from cmd. But it is not comfortable. I prefer IDLE or any other modern environment.
But if I try use matplotlib in IDLE - I got an "No module named 'matplotlib'". I tried to edit sys.path and run:
sys.path.append("C:\\ProgramData\\Anaconda3\\Lib\\site-packages").
It helps a little bit - I got new error "No module named 'matplotlib._path'". So, it looks like IDLE knows what is matplotlib now, but doesn't know it's functions.
Is there any way to connect IDLE with Anaconda's libraries? Maybe to append paths recursively?
It's probably not a good idea to mix the python distributions through the system path.
Python should ship with IDLE. So you can use the IDLE from the Anaconda distribution,
C:\ProgramData\Anaconda3>python.exe Lib\idlelib\idle.py
Also note that Anaconda should also provide Spyder. This might be a nicer IDE.