Python module not installed in Spyder but in all other IDEs - python

I have pip'd pycryptodome and criptography today to use in the Spyder IDE but keep getting the error at the bottom of this page when I try to import them.
However, If I try to import them in Sublime Text or IDLE they seem to be working fine.
I am not running Spyder form Anaconda as I was having other issues there with the input() function and am just running it from my Windows platform.
I have tried uninstalling the modules as well as Spyder itself to no avail, had my uni lecturer looking at it this afternoon as well with no such luck.
Python Version 3.9.6
Spyder Version 5.3.1
Any advice? If I need to give more info please let me know what you need and I'll try to get it.
Thanks in advance :)
ERROR MESSAGE:
runfile('[Omitted path and filename].py', wdir='[Omitted path and filename]')
Traceback (most recent call last):
File "C:\Users\Me\AppData\Local\Programs\Spyder\pkgs\spyder_kernels\py3compat.py", line 356, in compat_exec
exec(code, globals, locals)
File "[Omitted path and filename].py", line 9, in
from Crypto.Cipher import DES
ModuleNotFoundError: No module named 'Crypto'
Warning
It seems you're trying to use a module that doesn't come with our installer. Check this FAQ in our docs to learn how to do this.

Related

Speech Recognition module not working, despite being downloaded

I was following along a tutorial where they used the SpeechRecognition module, but when I made it to the first test it returns C:\Users\USER\PycharmProjects\Fatawi\venv\Scripts\python.exe C:/Users/USER/PycharmProjects/Fatawi/main.py Traceback (most recent call last): File "C:\Users\USER\PycharmProjects\Fatawi\main.py", line 1, in <module> import speech_recognition as sr ModuleNotFoundError: No module named 'speech_recognition'
I've tried reinstalling the library multiple times along with the PyAudio library. I ran the test that PyPi has for it and it works, but I don't know how fix it from here.
Check your python interpreter environment (the python version that's run the python file) maybe it's not the same version as python when you downloaded Speech Recognition.
Check if you activating the environemt.
For better understand see this blog in geeks for geeks might help you.
So aftergoing through some of the settings of the project file and checking the Python Interpreter it didn't have the SpeechRecognition Package. So I'm assuming that something went wrong with the install.
Thank you Faisal Faraj for the help.

What is pymunkoptions?

I'm pretty frustrated and I'm not even sure where to start. I'm trying to install python arcade and it's going poorly. I'm trying to run one of the tutorial scripts and I get back the following error.
Traceback (most recent call last):
File "", line 4, in
import arcade
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/arcade/init.py", line 103, in
from .drawing_support import calculate_hit_box_points_detailed
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/arcade/drawing_support.py", line 7, in
import pymunkoptions
ModuleNotFoundError: No module named 'pymunkoptions'
pymunk is saying it's installed. Does arcade not work on python 3.9?
I had the same problem.
I got round it by specifying that the version of pymunk needs to be 5.7.0 (apparently it's been updated since 5.7.0 and Arcade still needs to tweak some things to work properly).
In the requirements.txt in Pycharm (if you're following the instructions here: https://arcade.academy/venv_install/index.html), I put both:
arcade
pymunk==5.7.0
Did the trick for me.
File paths were setup incorrectly.

problem importing CPX library to use Device Simulator or Visual Sudio Code

I'm following our tutorial. I already had python set up in VSC but I'm trying to use the Device Simulator express now. I'm getting an error when I hit play. It seems the system can't find the library error on line:
from adafruit_circuitplayground import cp
The error is:
Traceback (most recent call last):
File "c:/Users/YayaLenovoFlex/Documents/Python Scripts/trySimulator1.py", line 12, in
from adafruit_circuitplayground import cp
ModuleNotFoundError: No module named 'adafruit_circuitplayground'
Please help. I've very new to Visual Studio Code. I would rather use VSC then the MU editor if I can.
Thanks
Have you installed libraries by this command?
pip install adafruit_circuitplayground

Terminal says, that “successfully installed openpyxl 6.2.2“ but I can't import it in IDLE ; why? (python, beginner)

I am a total beginner in terms of programming. Currently, I am working with this book https://automatetheboringstuff.com/2e/appendixa/.
In chapter 13 I need to install the openpyxl module. I did it exactly as the book told me to do, and my terminal confirms that it is installed. The same way I installed my pyperclip module ( which worked), but this time, every time I try to import it, it tells me, no module named openpyxl
Traceback (most recent call last):
File "", line 1, in
import openpyxl
ModuleNotFoundError: No module named 'openpyxl'
I have the newest version of python, and I tried openpyxl 2.6.2, or 2.6.1, but it is always the same.
I hope someone can help me, in another forum It was suggested to download Pycharm or Anaconda, but this is nothing that the book requires, and I have to stick to the instruction ( it is a university work).
Thank you!

Trouble importing Python modules on Ninja IDE

I have been trying to import modules into Ninja IDE for python. These are modules that I have working on the terminal (numpy, scipy, scitools, matplotlib, and mpl_toolkits), but will not run correctly in Ninja.
First I was only getting the message No module named ____. I checked sys.path and found that the path was within the application
/Applications/Ninja IDE.app/Contents/Resources/lib/python2.7 was a typical path. I tried changing the path,but it doesn't seem to do anything to sys.path even after restarting the ide.
But I wanted the path to refer to where the modules are stored (which is /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages). I was able to get numpy and scipy to work as well as parts of mpl_toolkits by adding the contents of my path to the folders that sys.path gave. However, I still can't get fully functioning modules within the ninja ide interpreter. I'll give some examples below of what happens when I import certain modules.
import matplotlib.pyplot
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/Applications/Ninja IDE.app/Contents/Resources/lib/python2.7/matplotlib/__init__.py", line 106, in <module>
ImportError: No module named sysconfig
import mpl_toolkits
from mpl_toolkits.mplot3d import axes3d
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/Applications/Ninja IDE.app/Contents/Resources/lib/python2.7/mpl_toolkits/mplot3d/__init__.py", line 1, in <module>
File "/Applications/Ninja IDE.app/Contents/Resources/lib/python2.7/mpl_toolkits/mplot3d/axes3d.py", line 14, in <module>
File "/Applications/Ninja IDE.app/Contents/Resources/lib/python2.7/matplotlib/__init__.py", line 106, in <module>
ImportError: No module named sysconfig
Thanks for the help. I apologize, I am very new to programming, but I did put in about a day and a half of research before posting here.
That's strange as the sysconfig module is a part of Python 2.7 standard library.
Are you sure that Ninja is using the right Python version? Try running:
import sys
print sys.version_info
from Ninja, to see which Python version it is actually using.
I know this question is a few months old, but I wanted to post my solution in case others find it useful. I had a very similar problem, and had a lot of trouble finding a quick workable solution anywhere.
My somewhat roundabout solution was to simply create a virtualenv folder with the version of numpy I wanted, and then pointed the "virtualenv" property for NinjaIDE project to that folder. I restarted NinjaIDE and boom, instantly worked.
To set the virtualenv property for your project via the GUI, go to the Project menu:
Project > Open Project Properties > Project Execution,
and you should see a variable called "Virtualenv Folder". Point that to the folder for your virtualenv, and it should work. (May need to restart NinjaIDE.) This worked for me, NinjaIDE version 2.2 under Ubuntu 12.04.
One quick note: I actually didn't use virtualenv exactly -- I had to use a "conda env," since I am using the Anaconda distribution, and apparently it is not well-tested with virtualenv yet. (I actually got a warning when I went to easy_install virtualenv. Hadn't seen that before.)
Either way, this stackoverflow question has some nice pointers to virtualenv tutorials: Comprehensive beginner's virtualenv tutorial?
Good luck!
I was having a similar problem trying to import a module from /home/paul/lib/python using the console of the Ninja-IDE. I found out that /home/paul/lib/python didn't appear in syspath when checking in the console of the Ninja-IDE. But it did in the terminal!
By starting the Ninja-IDE from the terminal, /home/paul/lib/python was in syspath when checking in the console of the Ninja-IDE. I was now able to import the module I needed.
I hope this might be of some help. If not to ebris1 than maybe to others.

Categories