I am using PyCharm and I'm trying to make a simple script that connects to a database.
In the PyCharm terminal, both mysqlclient installations from here seem to fail.
(venv) C:\Users\erics\CS261>pip install mysqlclient-1.4.6-cp38-cp38-win_amd64.whl
mysqlclient-1.4.6-cp38-cp38-win_amd64.whl is not a supported wheel on this platform.
(venv) C:\Users\erics\CS261>pip install mysqlclient-1.4.6-cp38-cp38-win32.whl
mysqlclient-1.4.6-cp38-cp38-win32.whl is not a supported wheel on this platform.
In Windows's terminal, they are succesfully installed:
C:\Users\erics>pip install mysqlclient-1.4.6-cp38-cp38-win32.whl
Processing c:\users\erics\mysqlclient-1.4.6-cp38-cp38-win32.whl
Installing collected packages: mysqlclient
Successfully installed mysqlclient-1.4.6
Even though it is "succesfully installed", my script does not seem to run...
C:\Users\erics\CS261\venv\Scripts\python.exe C:/Users/erics/CS261/venv/Scripts/test.py
Traceback (most recent call last):
File "C:/Users/erics/CS261/venv/Scripts/test.py", line 1, in <module>
import MySQLdb
ModuleNotFoundError: No module named 'MySQLdb'
Process finished with exit code 1
Related
I am trying to run an app I have built using python and kivy. I have created an Xcode file which builds successfully, but when I simulate the app in Xcode the following error message is raised:
Traceback (most recent call last):
File "/Users/orlandoalexander/alarmclock-ios/YourApp/main.py", line 11, in <module>
ModuleNotFoundError: No module named 'osascript'
2021-03-07 20:39:05.124675+0000 alarmclock[2937:103283] Application quit abnormally!
2021-03-07 20:39:05.156979+0000 alarmclock[2937:103283] Leaving
Why would this be? Do I need to import the module 'osascript' into Xcode in some way?
I have installed osascript using pip3 via command line.
Try installing osascript using
pip install osascript
Or u need to update the pip package (windows)
python -m pip install --upgrade pip
I tried installing a python package (BentoML) using pip install bentoml, and I received the following error, which gives a ModuleNotFoundError: No module named 'wrapt'. However, the wrapt module is actually included in my site-packages folder, so a pip install wrapt results in the message that I already have wrapt installed.
I can install other packages using pip, but the alembic package causes this issue. I was able to install using pip using my Anaconda Python, but I want it installed with this Python version. What is the best way forward?
I'm using Python 3.8.1 on a Windows 10 device.
ERROR: Command errored out with exit status 1:
command: 'c:\users\username\appdata\local\programs\python\python38\python.exe' 'c:\users\username\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\pep517\_in_process.py' get_requires_for_build_wheel 'C:\Users\user~1.lastname\AppData\Local\Temp\tmpd30adik_'
cwd: C:\Users\username\AppData\Local\Temp\pip-install-qers2adl\alembic
Complete output (14 lines):
Fatal Python error: init_import_size: Failed to import the site module
Python runtime state: initialized
Traceback (most recent call last):
File "c:\users\username\appdata\local\programs\python\python38\lib\site.py", line 580, in <module>
main()
File "c:\users\username\appdata\local\programs\python\python38\lib\site.py", line 573, in main
execsitecustomize()
File "c:\users\username\appdata\local\programs\python\python38\lib\site-packages\certifi_win32\bootstrap.py", line 37, in _execsitecustomize
_register_bootstrap_functions()
File "c:\users\username\appdata\local\programs\python\python38\lib\site-packages\certifi_win32\bootstrap.py", line 25, in _register_bootstrap_functions
from . import wrapt_certifi
File "c:\users\username\appdata\local\programs\python\python38\lib\site-packages\certifi_win32\wrapt_certifi.py", line 3, in <module>
import wrapt
ModuleNotFoundError: No module named 'wrapt'
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\username\appdata\local\programs\python\python38\python.exe' 'c:\users\username\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\pep517\_in_process.py' get_requires_for_build_wheel 'C:\Users\user~1.lastname\AppData\Local\Temp\tmpd30adik_' Check the logs for full command output.
Install using another version of Python. Open up an Anaconda prompt (or another version of Python on the same device), and run:
pip install alembic --target="c:\users\username\appdata\local\programs\python\python38\lib\site-packages"
This was the same approach I used when I broke Python after trying to uninstall/reinstall wrapt. The other Python version installs alembic to the correct location and the original install works.
I am trying to install and use psycopg2, using Python on Mac OS. After running into issue with install due to "pg_config not found" error, I downloaded source files and specified pg_config path in setup.cfg. Installation was successful but now psycopg2 encounters an error when imported.
Install
pip install /Users/k/Downloads/psycopg2-2.8.3
Processing ./Downloads/psycopg2-2.8.3
Installing collected packages: psycopg2
Running setup.py install for psycopg2: started
Running setup.py install for psycopg2: finished with status 'done'
Successfully installed psycopg2-2.8.3
Import error
import psycopg2
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/psycopg2/__init__.py", line 50, in <module>
from psycopg2._psycopg import ( # noqa
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/psycopg2/_psycopg.cpython-37m-darwin.so, 2): Library not loaded: libssl.1.1.dylib
Referenced from: /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/psycopg2/_psycopg.cpython-37m-darwin.so
Reason: image not found
Any help would be greatly appreciated!
If me, I would rather do it as follows:
$ pip install pipenv --user
$ pipenv shell
$ pipenv install psycopg2==2.8.3
$ python
>>> import psycopg2
When I run pip3 install hunspell==0.5.0, it seemingly installs without a hitch.
Collecting hunspell==0.5.0
Installing collected packages: hunspell
Successfully installed hunspell-0.5.0
Now, once I run pip3 install spacy-hunspell it seemingly installs as well.
Installing collected packages: spacy-hunspell
Successfully installed spacy-hunspell-0.1.0
However, once I open my project and import the package, I get:
Traceback (most recent call last):
File "genVocab.py", line 5, in <module>
from spacy_hunspell import spaCyHunSpell
File "/usr/local/lib/python3.7/site-packages/spacy_hunspell/__init__.py", line 5, in <module>
from hunspell import HunSpell
ImportError: dlopen(/usr/local/lib/python3.7/site-packages/hunspell.cpython-37m-darwin.so, 2): Symbol not found: __ZN8Hunspell14add_with_affixERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_
Referenced from: /usr/local/lib/python3.7/site-packages/hunspell.cpython-37m-darwin.so
Expected in: flat namespace
in /usr/local/lib/python3.7/site-packages/hunspell.cpython-37m-darwin.so
I've tried building hunspell, pyhunspell, and spacy-hunspell each from their source repos with different compiler flags and versions of GCC, but the problem persists.
Any idea how to move forward from here?
I have successfully installed PyMySQL in my Ubuntu 16.04 OS using pip command:
debarati#debarati-hp:~$ pip install PyMySQL
Collecting PyMySQL
Downloading PyMySQL-0.8.0-py2.py3-none-any.whl (83kB)
100% |████████████████████████████████| 92kB 159kB/s
Installing collected packages: PyMySQL
Successfully installed PyMySQL-0.8.0
Still when I am trying to execute a Python file called view_rows.py , it's giving the following error:
debarati#debarati-hp:~$ python view_rows.py
Traceback (most recent call last):
File "view_rows.py", line 5, in <module>
import PyMySQL
ModuleNotFoundError: No module named 'PyMySQL'
But, this does not give any error:
debarati#debarati-hp:~$ import PyMySQL
This is my Python version:
debarati#debarati-hp:~$ python -V
Python 3.6.3 :: Anaconda custom (64-bit)
The package name is "PyMySQL"; you use the package name to install it. To use the installed package, you need to use the module name, which may not be the same. In this case, the module is named "pymysql" (all lower-case).
The import should be import pymysql.
https://pymysql.readthedocs.io/en/latest/py-modindex.html