Windows 10, Python 3.8.5, using Mu 1.0.3. I am trying to install new modules. I just started learning python this weekend so I am pretty clueless. There does not seem to be much online that addresses this problem, unless I just don't know the right words.
I have tried going to command line and entering set PYTHONPATH="[a list of all paths that came up in response to printing sys.path]". The command line seemed to accept this, since it did not give me an error message. But Mu still gives me a
ModuleNotFoundError: no module named "modulename".
I have additionally obtained just the location of the module by typing its name into the shell, and then attempting sys.path.append("path"), in both Mu and the shell. I get the same ModuleNotFoundError.
So, how do I get the code editor to find modules? And, how do I make it a permanent fix?
As per this article the Mu editor has its own Python environment, separate from the one that typical Python installations have
Due to this, to be able to use them on Windows, we have to install our requirements into a specific location:
pip install –r automate-win-requirements.txt --target "C:\Users\USERNAME\AppData\Local\Mu\pkgs"
Related
I'm developing a script in Python 3.9 that works perfectly on my personal PC. When I tried moving and running it on a server, which has an older python version, it gives me the following error:
Does anyone know how to fix this error?
I tried to install dotenv via pip manually, but it doesn't work.
I think you should use Pylaucher, to start Pylaucher you must Use Shebang (#) in The Script Run Pylauncher Command. Then you will be able to run multiple versions of python in Windows without getting errors. There are too many methods you can use; I strongly suggest this one since has once worked for me.
I am new to Python so this may be a stupid question, sorry in advance if it is so!
The paths Python searches for modules using Spyder 4.1.4.:
[.., 'D:\Users\Martin\Anaconda3\lib\site-packages', ..]
The paths Python searches for when used via command line in windows:
[.., 'D:\Users\Martin\Anaconda3\lib\site-packages', ..]
Thus, both include path to
'D:\Users\Martin\Anaconda3\lib\site-packages'
where I store my cv2 module installed. Yet, Spyder can import cv2 and to my surprise cmd cannot import cv2 with an error No module named 'cv2'. What am I missing please? Can anyone verify if it works for him in command line please? (I changed/edited the question again to cut unneccessary long talk, though the essence stayed the same, in hope someone could answer).
I solved it. If you have a similar problem, you can check if your case is similar to mine and follow the steps.
I use Spyder and everything works fine. However my goal is to use Python via cmd. This could not be done because Python via cmd could not find my modules.
What I did: After typing python in cmd, Python worked and output its version by default. However, I noticed the version was different than version running in Spyder - I had two Python installations (one of which I didn't know about). I found the installation cmd uses by import sys and print(sys.executable). I uninstalled that Python installation.
Now, typing python in cmd does not do anything, it is an unknown command. Then I followed this guide to add my Python installation to Path (using Windows) by:
My Computer > Properties > Advanced System Settings > Environment Variables >
in System variables, I found "Path", clicked Edit, New, then input my Python installation path D:\Users\Martin\Anaconda3 as well as D:\Users\Martin\Anaconda3\Scripts and D:\Users\Martin\Anaconda3\Library\bin. This solved it for me.
it might be a pathing issue since the first error I got on script was the pygame module not existing and after trying to install the module on the terminal i keep getting a DEPRECATION message saying python 2.7 reached the end of it's life.......
I'm trying to figure out how to set my atom text editor path right and figure out how to use pip 3 on the terminal any advice on what to do?
just for context this was all working until sometime ago. I haven't downloaded anything since then.
Have u tried simply uninstalling python and reinstalling the newest version? Had this issue some times when teaching python, and uninstalling + reinstalling plus considering the correct environment variable path ( https://discuss.atom.io/t/running-python-on-atom/49460) solved it always so far, good luck!
I was smoothly working on my terminal having a good time and suddenly I don't know exactly what I did but now instead of the prompt having the regular directory path it now displays (With a percentage sign that I had never seen before):
emilio#Emilios-MacBook-Air-3 ~ %.
It's so weird because it just suddenly changed and now I can't run my Files correctly.
I was doing a project using Pillow and now the terminal prompts:
ModuleNotFoundError: No module named 'PIL'
Before this, I was using the file perfectly in the terminal and it never displayed such an error. I already looked up the problem on the internet but coudn't find the solution.
Your help would be great
In the upgrade to Catalina apple replaced bash with zsh
I think the solution for you will depend on which python distribution you have but there are a few stack overflow questions already that deal with this for the conda distribution, e.g. Conda not found after upgrading to macOS Catalina
and Can't find pip, conda, python modules after OSX Catalina update
Even if you are using another distribution, there might be something in there that is useful.
You may also be able to temporary or permanently switch back to bash with something like exec bash -l
When trying to run my code in Pycharm i get this error:
from .gurobipy import *
ImportError: libgurobi80.so: cannot open shared object file: No such file or directory
In the regular python terminal i can import gurobipy with no problem. How can Pycharm be fixed?
I've read the install instructions and posted the following 3 lines at the end of the bashrc file with a text editor.
export GUROBI_HOME="/opt/gurobi800/linux64"
export PATH="${PATH}:${GUROBI_HOME}/bin"
export LD_LIBRARY_PATH="${GUROBI_HOME}/lib"
Reinstalling PyCharm (even switching to EDU and Professional) as well as reinstalling Ubuntu did not change the error. Please help.
I had the same error and configured PyCharm on Kubuntu by adding the environment variables to the run config.
Select Edit configurations... and add the variables to the Environment variables field. In my case, I added GUROBI_HOME, LD_LIBRARY_PATH and GRB_LICENSE_FILE. Also, I had to enter the values directly: LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GUROBI_HOME/lib didn't work, but LD_LIBRARY_PATH=/path/to/gurobi/lib works.
Code completion and suggestions still don't work, but at least I can run from PyCharm now.
I went around this problem by just editing the file in PyCharm and running it via the terminal. I didn't find another solution so far, so I'm still proceeding this way. It seems to be a PyCharm-specific problem.
I tried more than 10 ways to install Gurobipy in Pycharm. However, there is no way to use.
There are two days to use Gurobipy
Jupyter based on Conda - installation : recommended by Grobipy.
Install Grobipy indirectly to python (This Is what i did for my setting)
Hope Pycharm and Gurobipy to work together to resolve this issue. But most people might use Jupyter these days. So don’t know how much they will be interested in fixing this.