using pip3: module “importlib._bootstrap” has no attribute “SourceFileLoader” - python

I want to install the graph based database library bulb. However when I try to do so I get:
(plA_env) (base) antoi#LAPTOP-UTL8OHHO:/mnt/c/Users/antoi/Documents/Programming/plAtform/plAtform$ python3 -m ensurepip --upgrade
Looking in links: /tmp/tmpz62_ljle
Requirement already up-to-date: setuptools in /mnt/c/Users/antoi/Documents/Programming/plAtform/plA_env/lib/python3.8/site-packages (41.2.0)
Requirement already up-to-date: pip in /mnt/c/Users/antoi/Documents/Programming/plAtform/plA_env/lib/python3.8/site-packages (19.2.3)
(plA_env) (base) antoi#LAPTOP-UTL8OHHO:/mnt/c/Users/antoi/Documents/Programming/plAtform/plAtform$ pip install bulbs
Collecting bulbs
Using cached https://files.pythonhosted.org/packages/7e/9c/fc1eb0de57ab9390e1edce7c61184d160e421fdb9643fde59a0334c85d34/bulbs-0.3.29-20140417.tar.gz
Collecting distribute (from bulbs)
Using cached https://files.pythonhosted.org/packages/5f/ad/1fde06877a8d7d5c9b60eff7de2d452f639916ae1d48f0b8f97bf97e570a/distribute-0.7.3.zip
ERROR: Command errored out with exit status 1:
command: /mnt/c/Users/antoi/Documents/Programming/plAtform/plA_env/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-x73ckeds/distribute/setup.py'"'"'; __file__='"'"'/tmp/pip-install-x73ckeds/distribute/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
cwd: /tmp/pip-install-x73ckeds/distribute/
Complete output (15 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-x73ckeds/distribute/setuptools/__init__.py", line 2, in <module>
from setuptools.extension import Extension, Library
File "/tmp/pip-install-x73ckeds/distribute/setuptools/extension.py", line 5, in <module>
from setuptools.dist import _get_unpatched
File "/tmp/pip-install-x73ckeds/distribute/setuptools/dist.py", line 7, in <module>
from setuptools.command.install import install
File "/tmp/pip-install-x73ckeds/distribute/setuptools/command/__init__.py", line 8, in <module>
from setuptools.command import install_scripts
File "/tmp/pip-install-x73ckeds/distribute/setuptools/command/install_scripts.py", line 3, in <module>
from pkg_resources import Distribution, PathMetadata, ensure_directory
File "/tmp/pip-install-x73ckeds/distribute/pkg_resources.py", line 1518, in <module>
register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
I already checked this answer but it all gives the error.
I am using Windows 10 and python 3.8.

Related

can't install mysql==0.0.2 in python==3.8.1 environment

I can't install mysql==0.0.2. I am able to install mysql==0.0.3. The error looks like.
Seems to me setuptools error.
(venv) C:\Users\xyz\Envs\>pip install mysql==0.0.2
Collecting mysql==0.0.2
Using cached mysql-0.0.2.tar.gz (1.9 kB)
ERROR: Command errored out with exit status 1:
command: 'c:\users\xyz\scripts\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\xyz\\AppData\\Local\\Temp\\pip-install-rygxsfpt\\mysql\\setup.py'"'"'; __file__='"'"'C:\\Users\\xyz\\AppData\\Local\\Temp\\pip-install-rygxsfpt\\mysql\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\xyz\AppData\Local\Temp\pip-install-rygxsfpt\mysql\pip-egg-info'
cwd: C:\Users\xyz\AppData\Local\Temp\pip-install-rygxsfpt\mysql\
Complete output (32 lines):
WARNING: `mysql` is a virtual package. Please use `%s` as a dependency directly.
running egg_info
creating C:\Users\xyzAppData\Local\Temp\pip-install-rygxsfpt\mysql\pip-egg-info\mysql.egg-info
writing C:\Users\xyzAppData\Local\Temp\pip-install-rygxsfpt\mysql\pip-egg-info\mysql.egg-info\PKG-INFO
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\xyz\AppData\Local\Temp\pip-install-rygxsfpt\mysql\setup.py", line 33, in <module>
setup(
File "c:\users\xyz\lib\site-packages\setuptools\__init__.py", line 87, in setup
return distutils.core.setup(**attrs)
File "c:\users\xyz\lib\site-packages\setuptools\_distutils\core.py", line 148, in setup
.....
.....
.....
lines = header.split('\n')
AttributeError: 'list' object has no attribute 'split'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
You shouldn't install mysql at all.
This package is a ‘virtual package’, which requires MySQL-python (Python 2) or mysqlclient (Python 3) to install. In effect, this means ‘pip install mysql’ will actually install MySQL-python.
Instead of depending on this package, please depend on the relevant package directly.
In a Python 3 world, use either
pip install mysqlclient (for MySQLdb), or
pip install mysql-connector-python (for mysql.connector).

Problems with installing plotly on Windows 10 with Python 3.8.5

I am having problems installing plotly on Windows 10 with Python 3.8.5. The command line prompt is in admin mode.
The package manager pip3 here seems to be installing the package retrying-1.3.3 which is running into an error:
ModuleNotFoundError: No module named '_distutils_hack'
Anybody has a solution for this? Greatly appreciate your time. Thanks
C:\ProgramData\Python38\Scripts>pip3 install plotly
Collecting plotly
Using cached plotly-4.14.1-py2.py3-none-any.whl (13.2 MB)
Requirement already satisfied: six in c:\programdata\python38\lib\site-packages (from plotly) (1.15.0)
Collecting retrying>=1.3.3
Using cached retrying-1.3.3.tar.gz (10 kB)
ERROR: Command errored out with exit status 1:
command: 'c:\programdata\python38\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\student\\AppData\\Local\\Temp\\pip-install-2qndeluw\\retrying_de785ef56b9d4150b577dd9f4437e271\\setup.py'"'"'; __file__='"'"'C:\\Users\\student\\AppData\\Local\\Temp\\pip-install-2qndeluw\\retrying_de785ef56b9d4150b577dd9f4437e271\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\student\AppData\Local\Temp\pip-pip-egg-info-3tjoj6d_'
cwd: C:\Users\student\AppData\Local\Temp\pip-install-2qndeluw\retrying_de785ef56b9d4150b577dd9f4437e271\
Complete output (5 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\programdata\python38\lib\site-packages\setuptools\__init__.py", line 8, in <module>
import _distutils_hack.override # noqa: F401
ModuleNotFoundError: No module named '_distutils_hack'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
The problem may be that the version of the 'setuptools' package is too old. I just updated it when I encountered this problem before.
pip install --upgrade setuptools

Error when installing Python packages with pip:

I've been getting this error for a few weeks now. Sometimes package installs go perfectly, but other times I get an error. For example I tried installing Pygame today (Apologies, the error is pretty long):
Collecting pygame
Using cached pygame-1.9.6.tar.gz (3.2 MB)
ERROR: Command errored out with exit status 1:
command: 'c:\users\owner\appdata\local\programs\python\python39\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\owner\\AppData\\Local\\Temp\\pip-install-y965ak00\\pygame\\setup.py'"'"'; __file__='"'"'C:\\Users\\owner\\AppData\\Local\\Temp\\pip-install-y965ak00\\pygame\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\owner\AppData\Local\Temp\pip-pip-egg-info-07wtjukl'
cwd: C:\Users\owner\AppData\Local\Temp\pip-install-y965ak00\pygame\
Complete output (17 lines):
WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
Using WINDOWS configuration...
Download prebuilts to "prebuilt_downloads" and copy to "./prebuilt-x64"? [Y/n]Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\owner\AppData\Local\Temp\pip-install-y965ak00\pygame\setup.py", line 194, in <module>
buildconfig.config.main(AUTO_CONFIG)
File "C:\Users\owner\AppData\Local\Temp\pip-install-y965ak00\pygame\buildconfig\config.py", line 210, in main
deps = CFG.main(**kwds)
File "C:\Users\owner\AppData\Local\Temp\pip-install-y965ak00\pygame\buildconfig\config_win.py", line 576, in main
and download_win_prebuilt.ask(**download_kwargs):
File "C:\Users\owner\AppData\Local\Temp\pip-install-y965ak00\pygame\buildconfig\download_win_prebuilt.py", line 302, in ask
reply = raw_input(
EOFError: EOF when reading a line
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
I read a few suggestions like pip(3) install setuptools Which said Requirement already satisfied: setuptools in c:\users\owner\appdata\local\programs\python\python39\lib\site-packages (50.3.2) I also tried pip install --upgrade pip Which said Requirement already up-to-date: pip in c:\users\owner\appdata\local\programs\python\python39\lib\site-packages (20.2.4)
Neither of those solved the problem. I'm running Windows 10 if that matters. Any suggestion would be greatly appreciated.
I think it is because pygame has not yet released an update for your python version. Pygame has "pre" versions.
pip install pygame --pre

Rasbian Lite: email Python Package install (No module named 'cStringIO')

Sorry for possible duplicate. I am using Rasbian Lite OS. When I try to install package email:
pi#raspberrypi:~ $ sudo pip3 install email
I get error message:
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting email
Using cached email-4.0.2.tar.gz (1.2 MB)
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-298bk50t/email/setup.py'"'"'; __file__='"'"'/tmp/pip-install-298bk50t/email/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-298bk50t/email/pip-egg-info
cwd: /tmp/pip-install-298bk50t/email/
Complete output (11 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python3.7/dist-packages/setuptools/__init__.py", line 17, in <module>
import setuptools.version
File "/usr/local/lib/python3.7/dist-packages/setuptools/version.py", line 1, in <module>
import pkg_resources
File "/usr/local/lib/python3.7/dist-packages/pkg_resources/__init__.py", line 36, in <module>
import email.parser
File "/tmp/pip-install-298bk50t/email/email/parser.py", line 10, in <module>
from cStringIO import StringIO
ModuleNotFoundError: No module named 'cStringIO'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
However, when I run:
sudo pip install cStringIO
I get an error:
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
ERROR: Could not find a version that satisfies the requirement cStringIO (from versions: none)
ERROR: No matching distribution found for cStringIO
So it seems I am stuck because I can't install cStringIO?
Any ideas/suggestions/solutions would be greatly appreciated.
Thanks!
Solved: was using wrong python version inside terminal

Openpyxl Pip Install Error: Command Errored Out

I continue to receive the following error when trying to install openpyxl:
pip install openpyxl
Collecting openpyxl
Using cached openpyxl-3.0.3.tar.gz (172 kB)
ERROR: Command errored out with exit status 1:
command: /home/bigdata/scripts/bin/python3.8 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-eztesmv9/openpyxl/setup.py'"'"'; __file__='"'"'/tmp/pip-install-eztesmv9/openpyxl/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-eztesmv9/openpyxl/pip-egg-info
cwd: /tmp/pip-install-eztesmv9/openpyxl/
Complete output (11 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/bigdata/scripts/lib/python3.8/site-packages/setuptools/__init__.py", line 20, in <module>
from setuptools.dist import Distribution, Feature
File "/home/bigdata/scripts/lib/python3.8/site-packages/setuptools/dist.py", line 36, in <module>
from setuptools import windows_support
File "/home/bigdata/scripts/lib/python3.8/site-packages/setuptools/windows_support.py", line 2, in <module>
import ctypes
File "/home/bigdata/lib/python3.8/ctypes/__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Based on other posts, I have already tried the following commands:
python3 -m ensurepip --upgrade
pip install --upgrade setuptools
pip install -U pip
With each of them returning:
Requirement already up-to-date: setuptools in /home/bigdata/scripts/lib/python3.8/site-packages (45.1.0)
Am I missing something? We just migrated our account over to an A2 Hosting VPS server and I am unfamiliar with most of the setup. Any help is much appreciated.
I was able to fix this issue by reinstalling python, following the clue from phd that I may have a broken install.

Categories