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
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.
Using Gurobi on VSCode on Windows 10.
I have the following code
import gurobipy as gp
from gurobipy import GRB
Now the interesting this is that when I put this in a .py file, I get the error
No name 'GRB' in module 'gurobipy'
But doing the same thing a Jupyter notebook yields no error.
I installed gurobipy with pip as per the instructions here: https://support.gurobi.com/hc/en-us/articles/360044290292-Installing-Gurobi-for-Python
Further, I have the same version of Python (3.9.1) on both Jupyter Notebook and in the system (checked by running python --version) and pip freeze shows gurobipy installed.
I have found a fix for it.
https://medium.com/#haominnn/how-to-deal-with-python-not-finding-tensor-flow-module-under-anaconda-3aefa8ffae11
Essentially just disable pylint and replace with pep8.
The medium link is outdated for pep8, use VS Code doesn't recognize pep8 instead
I was working on using the Simple Transformers python library from here when I got a Windows error with following error when running the example code on the import statement from simpletransformers.classification import ClassificationModel:
"The procedure entry point cusparseGetErrorString could not be located in the dynamic link library cusparse64_10.dll"
I've tried reinstalling the relevant within the Conda environment as described on the GitHub, reinstalling CUDA itself and running a registry cleaner but I haven't been able to help this issue and I've run out of ideas to approach this, so I would appreciate any help.
CUDA has been working fine for me outside of Conda environments previously.
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