I do not understand how Intellij "finds" the installed python modules.
Here is an example: I have installed the python mysqldev
sudo apt-get install python-mysqldb
It is working on command line python. But IJ does not see it
File "/shared/git2/etl/appminer/hive/DB.py", line 7, in <module>
import MySQLdb
ImportError: No module named MySQLdb
So how to make IJ aware of the installed python libs?
thanks
Related
I have multiple python interperters in my computer 3.7 and 3.8. When I debug using with python 3.8 I do not face any issues using VSCode. My VScode python debugger fails when trying to debug with python 3.7. How do I install ctypes for python 3.7?
File "/home/kumar/.vscode/extensions/ms-python.python-2021.5.842923320/pythonFiles/lib/python/debugpy/launcher/../../debugpy/launcher/debuggee.py", line 8, in <module>
import ctypes
File "/usr/local/lib/python3.7/ctypes/__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'
Try pip uninstall ctypes, and then uninstall and reinstall ur python 3.7 and then try again pip install ctypes and then import ctypes in python interpreter.
ctypes is a built in library (I think from python2.5)
This means you dont need to install it, it is coming built in when you install python.
As far as using the correct version, see the pyenv module - it will make sure you are running the correct python version, and IMO makes life much easier
Have you checked which pip you are using? Make sure you have taken the right pip to install the package in the right place.
You can take pip --version command to check which pip you are using.
these are the Error messages I am geeting on running any of my project modules.
Traceback (most recent call last):
File "C:\Users\hsnl\BlockchainCodesTutor\Wallet.py", line 3, in <module>
import Transactions
File "C:\Users\hsnl\BlockchainCodesTutor\Transactions.py", line 2, in <module>
import Signatures
File "C:\Users\hsnl\BlockchainCodesTutor\Signatures.py", line 2, in <module>
import cryptography
ModuleNotFoundError: No module named 'cryptography'
I have already installed the cryptography module and was working perfectly until today I start getting this message that " No module named 'cryptography'".
I have again installed the cryptography as well as pip package but still showing the same error.
There might be loose versions running on your system. Please try the following:
python -m pip uninstall cryptography
python -m pip install cryptography
You can also check out this with python -m to make sure you are not using a loose pip.
You might not have cryptogtaphy installed correctly. I see you are using windows. Open commandline as an administrator and run pip install cryptography again. Enshure that the installation finishes without any errors and consider to restart your python interpreter after installation.
For further help you should post more details like the output of pip and your code leading to the error, so a more detailed answer for your problem can be given.
Try download cryptography whl from here.
Then use pip install cryptography-XXX.whl
For example:
pip install cryptography-3.3.1-cp36-abi3-win_amd64.whl
And now just supports python2.7 and python3.6.
The default Python version for MSYS2 seems to be 3.8. I need to use 3.7 at the moment because I have to use PyInstaller and it is not currently compatible with 3.8 in MSYS2. I can download the earlier version of Python from http://repo.msys2.org/ and install it using pacman. With a fresh install of MSYS2 I run the following commands:
pacman -S glib2-devel
pacman -U python-3.7.4-1-x86_64.pkg.tar.xz
pacman -S python-pip
pacman -S python-setuptools
If I try to run a python script I am met with an error:
File "setup.py", line 15, in <module>
from setuptools import setup
ModuleNotFoundError: No module named 'setuptools'
This is due to the fact that everything installed after Python is actually installing in the default Python 3.8 location rather than 3.7:
C:\msys64\usr\lib\python3.8\site-packages
If I copy and paste the contents of site-packages into Python 3.7 and then try running a script I get the error:
File "setup.py", line 15, in <module>
from setuptools import setup
File "/usr/lib/python3.7/site-packages/setuptools/__init__.py", line 19, in <module>
from setuptools.dist import Distribution
File "/usr/lib/python3.7/site-packages/setuptools/dist.py", line 34, in <module>
from setuptools import windows_support
File "/usr/lib/python3.7/site-packages/setuptools/windows_support.py", line 2, in <module>
import ctypes
File "/usr/lib/python3.7/ctypes/__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ImportError: No such file or directory
Which is supposed to be resolved via libffi, which was installed prior to Python, but likely does not go to a location that 3.7 can recognize?
Is there a way to set a specific version of Python as the default in MSYS2? Perhaps a path that can be set in the .bashrc file? I tried to set PYTHONPATH in there to Python 3.7 but it didn't make a difference as to where the packages ended up being installed to.
Go to the following URL...
https://repo.msys2.org/msys/x86_64/
Look for the version of the package you need and download it. Use
pacman -U pkgname
To install it...
The reason I know this is because gcc11 on MSYS is non-functional... it produces programs which crash and say
"During startup your program exited with code..." mentioned here:
During startup program exited with code 0xc0000139
The only workaround is to downgrade to the previous compiler which does work or use clang, which was not an option for me.
Trying to use an old version of Python is probably possible, but I think it will be very difficult. You would need to make sure all the other installed packages are compatible.
I am using PyInstaller with Python 3.8 in MSYS2 without issues. I would recommend trying to work through any issues with that, instead of trying to use older versions of packages.
I am facing some difficulty when I try to run a Flask app. I get the following import error:
File "/db/mysql_utils.py", line 2, in <module>
import mysql.connector.pooling
ImportError: No module named pooling
I tried several ways to install mysql_connector_python-1.0.12 such as
sudo pip install https://cdn.mysql.com/Downloads/Connector-Python/mysql-connector-python-1.0.12.tar.gz
Download the file to local and install it. Also tried running the setup.py and had no luck.
I am assuming mysql.connector.pooling is part of mysql-connector-python, but please correct me if I am wrong.
Thanks
On my Centos7 box, i installed the community-release repo and mysql-connector.
sudo yum update mysql-community-release
sudo yum install mysql-connector-python
https://dev.mysql.com/doc/connector-python/en/connector-python-installation-binary.html
I need to run an application written in python. When I try to load it from terminal I get this error:
File "/usr/local/bin/soar", line 3, in <module>
import form.main
File "/usr/local/lib/python2.6/site-packages/form/main.py", line 14, in <module>
from Tkinter import *
File "/usr/local/lib/python2.6/lib-tk/Tkinter.py", line 39, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: No module named _tkinter
I installed python 2.6.6 from the source files. I am really confused!!
How should I install tkinter?
I am running Xubuntu 13.10. You can see the different versions of python already installed in the below:
How can I remove python2.6.6? I tried to remove all files and folders related to python2.6. Now when I run python, it still loads python 2.6.6 I really have no idea what to do!! I tried to follow the instructions here and here to uninstall it but it did not work, that's why I deleted all the files and folders manually.
Type the following in your terminal:
sudo apt-get install python-tk
Install python3-tk package if you need Tkinter functionality in the 3rd version of python.