ImportError: No module named build_lib - python

I'm trying to run the pip install command in this way: pip install pyverdict --upgrade, but I get the following error: ImportError: No module named build_lib. How can I resolve this?
More detailed error:
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting pyverdict
Using cached https://files.pythonhosted.org/packages/81/be/c7f5803f599fa74b26ac9b2be385f19f14ce573540371f1f2c1c59a51a80/pyverdict-0.1.3.1.tar.gz
ERROR: Complete output from command python setup.py egg_info:
ERROR: Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-hBPHyv/pyverdict/setup.py", line 21, in <module>
from build_lib import build_and_copy
ImportError: No module named build_lib
----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-hBPHyv/pyverdict/

Related

ModuleNotFoundError during pip install when module is actually installed

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.

gramex install error: import pip.req ImportError: No module named req

My Environment details:
Python 3.6.4 :: Anaconda, Inc.
anaconda-script.py Command line client (version 1.4.0)
pip 10.0.1
I'm getting below error while trying to install with
pip install -verbose gramex or
pip install -e . (from )
```
(gramex_34) <src_path>\\gramex>pip install -e .
Obtaining file:///<src_path>/gramex
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "<src_path>\gramex\setup.py", line 7, in
<module>
from pip.req import parse_requirements
ImportError: No module named req
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in <src_path>\gramex\
I could get the below ref on SoF its a usage issue with latest version of pip:
pip-git-issue
similar-issue-thread
UPDATE: Since Jun 2018, this issue does not arise.
ORIGINAL ANSWER:
Yes Joshua - this was raised as an issue but isn't fixed yet.
The workaround is to downgrade from pip 10 to pip 9 -- and then install. This is not ideal. Will try and have a fix soon.

MySQL-python installation not working within virtualenv

I am trying to connect a MySQL database to my Django project, but when I try to install MySQL-python, it gives me the following error:
Collecting mysql-python
Using cached MySQL-python-1.2.5.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/fr/3k1nrq490dzdz9s48k49m9640000gn/T/pip-build-4dsuxwwv/mysql-python/setup.py", line 13, in <module>
from setup_posix import get_config
File "/private/var/folders/fr/3k1nrq490dzdz9s48k49m9640000gn/T/pip-build-4dsuxwwv/mysql-python/setup_posix.py", line 2, in <module>
from ConfigParser import SafeConfigParser
ModuleNotFoundError: No module named 'ConfigParser'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/fr/3k1nrq490dzdz9s48k49m9640000gn/T/pip-build-4dsuxwwv/mysql-python/
I have tried pip3 install ConfigParser, but while it gets installed, the error still occurs.
When I try to run my Django server, it prints out a long error log, and at the end:
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.
Did you install mysqlclient?
and when I looked at the following link, it said that I should install MySQL-python: Django mysqlclient install
May seem like a newbie question, but I can't seem to find similar errors elsewhere online.
EDIT:: Ok, looks like MySQL-python is not for python-3.6
While I did pip3 install mysqlclient, the virtualenv is saying that I have already installed it when I run the command again. But when I try to python3 manage.py runserver, I get the above error, asking if I had installed it. When I try to give an answer, I am unable to. Everytime I press ENTER, it just creates a new line and the prompt is still active.
The above error is preceded by the following text:
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x1059d9048>
Traceback (most recent call last):
File "/Users/karthikpullela/Desktop/Django-projects/QB-test/QB/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 15, in <module>
import MySQLdb as Database
File "/Users/karthikpullela/Desktop/Django-projects/QB-test/QB/lib/python3.6/site-packages/MySQLdb/__init__.py", line 19, in <module>
import _mysql
ImportError: dlopen(/Users/karthikpullela/Desktop/Django-projects/QB-test/QB/lib/python3.6/site-packages/_mysql.cpython-36m-darwin.so, 2): Library not loaded: libmysqlclient.18.dylib
Referenced from: /Users/karthikpullela/Desktop/Django-projects/QB-test/QB/lib/python3.6/site-packages/_mysql.cpython-36m-darwin.so
Reason: image not found
The above exception was the direct cause of the following exception:
Python 3 does not include ConfigParser
only has configparser
>>> import ConfigParser
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'ConfigParser'
>>> import configparser
Try Python 2.7 which still works if we use import ConfigParser
Try to install with different package, it has support for python 3.
pip install mysqlclient
If there is error while installing in virtualenv, do install this first.
sudo apt-get -y install python3-dev libmysqlclient-dev

MySQL with Django - Python

I'm integrating MySQL as backend with my Django application. At the time of installation i'm running following command (using mac os)
export PATH=$PATH:/usr/local/mysql/bin
start server from settings (i'm on mac os)
brew install mysql-connector-c
sudo pip install MySQL-python
while running last command i'm getting following error,
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/tmp/pip-build-wd69ia4g/MySQL-python/setup.py", line 13, in <module>
from setup_posix import get_config
File "/private/tmp/pip-build-wd69ia4g/MySQL-python/setup_posix.py", line 2, in <module>
from ConfigParser import SafeConfigParser
ImportError: No module named 'ConfigParser'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-wd69ia4g/MySQL-python/
I google the error and got the solutions as run following command
export PATH=$PATH:/usr/local/mysql/bin
But it doesn't solve my error.
Can any body help me to get out of it or let me know the steps for the initial MySQL setup.
Can not getting the solution than i'm ready for the fresh installation. Post the exact steps here

Django - MySQL doens't work with python 3.4.3 on osx 10.9.5

I'm building a web application that needs to use a mySql database. I created a database in mysql workbench. When i try to run the command for django :
'python manager.py runserver'
i get the following error:
django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named 'MySQLdb'
When i try to install MySQLdb (for python 3.4.3) via 'pip install mysql-python' i get following error :
Collecting mysql-python
Using cached MySQL-python-1.2.5.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/private/var/folders/cg/_w0sc5ms4hj3k5rcrf2mfm500000gn/T/pip-build-5qbm_4en/mysql-python/setup.py", line 13, in <module>
from setup_posix import get_config
File "/private/var/folders/cg/_w0sc5ms4hj3k5rcrf2mfm500000gn/T/pip-build-5qbm_4en/mysql-python/setup_posix.py", line 2, in <module>
from ConfigParser import SafeConfigParser
ImportError: No module named 'ConfigParser'
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/cg/_w0sc5ms4hj3k5rcrf2mfm500000gn/T/pip-build-5qbm_4en/mysql-python
Read about MySQL-python on PyPI:
MySQL-3.23 through 5.5 and Python-2.4 through 2.7 are currently supported. Python-3.0 will be supported in a future release. PyPy is supported.
If you want to stick to Python 3.x you'll need to use mysqlclient

Categories