C:\Windows\system32>scrapy startproject tutorial
Traceback (most recent call last):
File "C:\Python34\Scripts\scrapy-script.py", line 9, in <module>
load_entry_point('Scrapy==0.24.4', 'console_scripts', 'scrapy')()
File "C:\Python34\lib\site-packages\pkg_resources.py", line 353, in load_entry
_point
return get_distribution(dist).load_entry_point(group, name)
File "C:\Python34\lib\site-packages\pkg_resources.py", line 2302, in load_entr
y_point
return ep.load()
File "C:\Python34\lib\site-packages\pkg_resources.py", line 2029, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "C:\Python34\lib\site-packages\scrapy\__init__.py", line 28, in <module>
import _monkeypatches
ImportError: No module named '_monkeypatches'
I'm a newbie in scrapy & python. I was trying to create a scrapy project but wasn't able to. I have installed pip, setuptools, lxml and scrapy.
C:\Windows\system32>pip list
cffi (0.8.6)
cryptography (0.5.4)
cssselect (0.9.1)
lxml (3.4.0)
pip (1.5.6)
pycparser (2.10)
pyOpenSSL (0.14)
queuelib (1.2.2)
Scrapy (0.24.4)
setuptools (2.1)
six (1.8.0)
Twisted (14.0.2)
w3lib (1.10.0)
zope.interface (4.1.1)
Please help! I've been searching around but still couldn't find a solution.
Scrapy is supported under Python 2.7 only at the moment. You'll need to install 2.7 for this to work.
Related
I have Beta 4 of Python 10 installed (which I must use because I need pattern matching feature only available in v3.10):
C:\Users\myname\Documents\Projects\Project Migration\SeleniumExamplePy>py -3 --version
Python 3.10.0b4
and I made sure my pyinstaller is up to date:
C:\Users\myname\Documents\Projects\Project Migration\SeleniumExamplePy>pip install --upgrade pyinstaller
Requirement already satisfied: pyinstaller in c:\users\myname\appdata\local\programs\python\python310\lib\site-packages (4.4)
Requirement already satisfied: pefile>=2017.8.1 in c:\users\myname\appdata\local\programs\python\python310\lib\site-packages (from pyinstaller) (2021.5.24)
Requirement already satisfied: pyinstaller-hooks-contrib>=2020.6 in c:\users\myname\appdata\local\programs\python\python310\lib\site-packages (from pyinstaller) (2021.2)
Requirement already satisfied: pywin32-ctypes>=0.2.0 in c:\users\myname\appdata\local\programs\python\python310\lib\site-packages (from pyinstaller) (0.2.0)
Requirement already satisfied: setuptools in c:\users\myname\appdata\local\programs\python\python310\lib\site-packages (from pyinstaller) (56.0.0)
Requirement already satisfied: altgraph in c:\users\myname\appdata\local\programs\python\python310\lib\site-packages (from pyinstaller) (0.17)
Requirement already satisfied: future in c:\users\myname\appdata\local\programs\python\python310\lib\site-packages (from pefile>=2017.8.1->pyinstaller) (0.18.2)
I am getting ImportError: No module named _bootlocale error while trying to convert my python code that I thoroughly tested to executable:
**C:\Users\myname\Documents\Projects\Project Migration\SeleniumExamplePy>pyinstaller --onefile --clean ExtractRules.spec**
83 INFO: PyInstaller: 4.4
83 INFO: Python: 3.10.0b4
100 INFO: Platform: Windows-10-10.0.18363-SP0
110 INFO: UPX is not available.
110 INFO: Removing temporary files and cleaning cache in C:\Users\myname\AppData\Local\pyinstaller
113 INFO: Extending PYTHONPATH with paths
['C:\\Users\\myname\\Documents\\Projects\\Project '
'Migration\\SeleniumExamplePy',
'C:\\Users\\myname\\Documents\\Projects\\Project '
'Migration\\SeleniumExamplePy']
126 INFO: checking Analysis
126 INFO: Building Analysis because Analysis-00.toc is non existent
126 INFO: Initializing module dependency graph...
126 INFO: Caching module graph hooks...
139 INFO: Analyzing base_library.zip ...
3449 INFO: Processing pre-find module path hook distutils from 'c:\\users\\myname\\appdata\\local\\programs\\python\\python310\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-distutils.py'.
3449 INFO: distutils: retargeting to non-venv dir 'c:\\users\\myname\\appdata\\local\\programs\\python\\python310\\lib'
Traceback (most recent call last):
File "c:\users\myname\appdata\local\programs\python\python310\lib\runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\myname\appdata\local\programs\python\python310\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Users\myname\AppData\Local\Programs\Python\Python310\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
File "c:\users\myname\appdata\local\programs\python\python310\lib\site-packages\PyInstaller\__main__.py", line 126, in run
run_build(pyi_config, spec_file, **vars(args))
File "c:\users\myname\appdata\local\programs\python\python310\lib\site-packages\PyInstaller\__main__.py", line 65, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "c:\users\myname\appdata\local\programs\python\python310\lib\site-packages\PyInstaller\building\build_main.py", line 758, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "c:\users\myname\appdata\local\programs\python\python310\lib\site-packages\PyInstaller\building\build_main.py", line 705, in build
exec(code, spec_namespace)
File "ExtractRules.spec", line 7, in <module>
a = Analysis(['ExtractRules.py'],
File "c:\users\myname\appdata\local\programs\python\python310\lib\site-packages\PyInstaller\building\build_main.py", line 254, in __init__
self.__postinit__()
File "c:\users\myname\appdata\local\programs\python\python310\lib\site-packages\PyInstaller\building\datastruct.py", line 159, in __postinit__
self.assemble()
File "c:\users\myname\appdata\local\programs\python\python310\lib\site-packages\PyInstaller\building\build_main.py", line 354, in assemble
self.graph = initialize_modgraph(
File "c:\users\myname\appdata\local\programs\python\python310\lib\site-packages\PyInstaller\depend\analysis.py", line 882, in initialize_modgraph
graph = PyiModuleGraph(
File "c:\users\myname\appdata\local\programs\python\python310\lib\site-packages\PyInstaller\depend\analysis.py", line 122, in __init__
self._analyze_base_modules()
File "c:\users\myname\appdata\local\programs\python\python310\lib\site-packages\PyInstaller\depend\analysis.py", line 289, in _analyze_base_modules
self._base_modules = [mod
File "c:\users\myname\appdata\local\programs\python\python310\lib\site-packages\PyInstaller\depend\analysis.py", line 291, in <listcomp>
for mod in self.import_hook(req)]
File "c:\users\myname\appdata\local\programs\python\python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1505, in import_hook
target_package, target_module_partname = self._find_head_package(
File "c:\users\myname\appdata\local\programs\python\python310\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1711, in _find_head_package
raise ImportError("No module named " + target_package_name)
ImportError: No module named _bootlocale
I looked at this comment
https://bugzilla.redhat.com/show_bug.cgi?id=1899950
that AzyCrw4282 posted the link to in response to a very similar question PyInstaller - ImportError: No module named _bootlocale
and there is a statement by Victor Stinner 2021-01-19 10:25:32 UTC
"Oh, _bootlocale was a private module which should not be imported
directly. I removed it and replaced it with a new
_locale._get_locale_encoding() function in Python 3.10"
So, if the module was removed, why the latest pyinstaller still tries to pull it in?
Is it because I am using Python 3.10b4 and pyinstaller was not updated for it yet?
Is there a way to exclude the _bootlocale module from the executable build to be able to build the executable?
I tested my program exhaustively and it works with no problem when run from .py. I do not call anything that directly refers to bootlocale module, not 100% sure what it does or did before being removed from 3.10.
It's a Python 3.10 compatibility issue, and it's mentioned here.
You can solve it by adding --exclude-module _bootlocale to your command.
For instance:
pyinstaller.exe app.py --exclude-module _bootlocale
Had the same problem, all you need is to install pyinstaller and then install the 3.10 support.
Use:
pip install pyinstaller
pip install https://github.com/rokm/pyinstaller/archive/refs/heads/python-3.10.zip
Try to install the latest version of Pyinstaller
This solves me the problem:
pip install pyinstaller==4.10
This appears to be a version mismatch between pyinstaller and python. I recently upgraded to python3.10, installed from requirements.txt, and then had this issue. I was running pyinstaller 4.5.1, but the latest is pyinstaller 5.1. You can get the latest pyinstaller by doing the following:
pip install --upgrade pyinstaller
or
python -m pip install --upgrade pyinstaller
Use this command to install pyinstaller first.
pip install pyinstaller==4.10
Or if you want to install the latest version of pyinstaller use:
pip install pyinstaller
After installing try to create your exe again and it will work.
I fixed it in my poetry project by editing pyproject.toml:
[tool.poetry.dependencies]
python = "^3.8"
to
[tool.poetry.dependencies]
python = "^3.8,<3.11"
in my case i solved it by uninstalling the fbs package
pip3 uninstall fbs
This question already has answers here:
Pip does not work after upgrade to ubuntu-16.10
(3 answers)
Closed 5 years ago.
I am trying to install h5py and execute sudo
pip3 install h5py
I also tried to install h5py via wheel from https://pypi.python.org/pypi/h5py/2.7.0rc2
I have python 3.5 installed. And pip3 then crashes with this output:
Traceback (most recent call last):
File "/usr/local/bin/pip3", line 7, in <module>
from pip import main
File "/usr/local/lib/python3.5/dist-packages/pip/__init__.py", line 26, in <module>
from pip.utils import get_installed_distributions, get_prog
File "/usr/local/lib/python3.5/dist-packages/pip/utils/__init__.py", line 27, in <module>
from pip._vendor import pkg_resources
File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 3018, in <module>
#_call_aside
File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 3004, in _call_aside
f(*args, **kwargs)
File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 3046, in _initialize_master_working_set
dist.activate(replace=False)
File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 2578, in activate
declare_namespace(pkg)
File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 2152, in declare_namespace
_handle_ns(packageName, path_item)
File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 2092, in _handle_ns
_rebuild_mod_path(path, packageName, module)
File "/usr/local/lib/python3.5/dist-packages/pip/_vendor/pkg_resources/__init__.py", line 2121, in _rebuild_mod_path
orig_path.sort(key=position_in_sys_path)
AttributeError: '_NamespacePath' object has no attribute 'sort'
I'm running on Ubuntu 16.04.3 LTS
I don't think pip3 is broken because I installed a lot with pip3 before.
What can I do?
Thanks a lot.
I would start by not using sudo to install, but use an virtualenv. I use virtualenvwrapper personally. Following works fine for me locally.
$ mkvirtualenv bla --python=python3 # Random naming
# Env is activated right away
$ pip3 install h5py
Collecting h5py
Downloading h5py-2.7.1-cp35-cp35m-manylinux1_x86_64.whl (5.3MB)
100% |████████████████████████████████| 5.3MB 340kB/s
Collecting six (from h5py)
Using cached six-1.11.0-py2.py3-none-any.whl
Collecting numpy>=1.7 (from h5py)
Downloading numpy-1.14.0-cp35-cp35m-manylinux1_x86_64.whl (17.1MB)
100% |████████████████████████████████| 17.1MB 118kB/s
Installing collected packages: six, numpy, h5py
Successfully installed h5py-2.7.1 numpy-1.14.0 six-1.11.0
I tried to install pylint on windows (using visual studio code). I have this exception, I can't find a solution.
I already tried to completely reinstall python but I have the exact same error.
On other PC, the same repro step works fine.
>"C:\Program Files (x86)\Python36-32\python" -m pip install pylint
Collecting pylint
Downloading pylint-1.7.2-py2.py3-none-any.whl (644kB)
100% |████████████████████████████████| 645kB 1.9MB/s
Collecting colorama; sys_platform == "win32" (from pylint)
Downloading colorama-0.3.9-py2.py3-none-any.whl
Collecting astroid>=1.5.1 (from pylint)
Downloading astroid-1.5.3-py2.py3-none-any.whl (269kB)
100% |████████████████████████████████| 276kB 4.1MB/s
Collecting isort>=4.2.5 (from pylint)
Downloading isort-4.2.15-py2.py3-none-any.whl (43kB)
100% |████████████████████████████████| 51kB 5.7MB/s
Collecting mccabe (from pylint)
Downloading mccabe-0.6.1-py2.py3-none-any.whl
Collecting six (from pylint)
Downloading six-1.10.0-py2.py3-none-any.whl
Collecting lazy-object-proxy (from astroid>=1.5.1->pylint)
Downloading lazy_object_proxy-1.3.1-cp36-cp36m-win32.whl
Collecting wrapt (from astroid>=1.5.1->pylint)
Downloading wrapt-1.10.11.tar.gz
Installing collected packages: colorama, six, lazy-object-proxy, wrapt, astroid, isort, mccabe, pylint
Running setup.py install for wrapt ... error
Exception:
Traceback (most recent call last):
File "C:\Program Files (x86)\Python36-32\lib\site-packages\pip\compat\__init__.py", line 73, in console_to_str
return s.decode(sys.__stdout__.encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 5: invalid continuation byte
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Program Files (x86)\Python36-32\lib\site-packages\pip\basecommand.py", line 215, in main
status = self.run(options, args)
File "C:\Program Files (x86)\Python36-32\lib\site-packages\pip\commands\install.py", line 342, in run
prefix=options.prefix_path,
File "C:\Program Files (x86)\Python36-32\lib\site-packages\pip\req\req_set.py", line 784, in install
**kwargs
File "C:\Program Files (x86)\Python36-32\lib\site-packages\pip\req\req_install.py", line 878, in install
spinner=spinner,
File "C:\Program Files (x86)\Python36-32\lib\site-packages\pip\utils\__init__.py", line 676, in call_subprocess
line = console_to_str(proc.stdout.readline())
File "C:\Program Files (x86)\Python36-32\lib\site-packages\pip\compat\__init__.py", line 75, in console_to_str
return s.decode('utf_8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 5: invalid continuation byte
Do you have any what the problem could be?
EDIT:
As Shankar said, I installed astroid manually. It didn't work the first time. I encountered this issue: python easy_install pylint Error: The system cannot find the file specified
The installation finally worked but nothing changed for pylint.
Here is the log I receive when I try to run pylint
Traceback (most recent call last):
File "c:\program files (x86)\python36-32\lib\runpy.py", line 193, in _run_modu
le_as_main
"__main__", mod_spec)
File "c:\program files (x86)\python36-32\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Program Files (x86)\Python36-32\Scripts\pylint.exe\__main__.py", line
9, in <module>
File "c:\program files (x86)\python36-32\lib\site-packages\pylint\__init__.py"
, line 12, in run_pylint
from pylint.lint import Run
File "c:\program files (x86)\python36-32\lib\site-packages\pylint\lint.py", li
ne 43, in <module>
import astroid
File "c:\program files (x86)\python36-32\lib\site-packages\astroid\__init__.py
", line 57, in <module>
from astroid.nodes import *
File "c:\program files (x86)\python36-32\lib\site-packages\astroid\nodes.py",
line 30, in <module>
from astroid.node_classes import (
File "c:\program files (x86)\python36-32\lib\site-packages\astroid\node_classe
s.py", line 26, in <module>
from astroid import decorators
File "c:\program files (x86)\python36-32\lib\site-packages\astroid\decorators.
py", line 12, in <module>
import wrapt
File "c:\program files (x86)\python36-32\lib\site-packages\wrapt\__init__.py",
line 4, in <module>
from .wrappers import (ObjectProxy, CallableObjectProxy, FunctionWrapper,
ModuleNotFoundError: No module named 'wrapt.wrappers'
Thanks
Install
Pylint requires astroid package (the later the better).
https://github.com/PyCQA/astroid
Installation should be as simple as
python -m pip install astroid
Pylint requires isort package (the later the better).
https://github.com/timothycrosley/isort
Installation should be as simple as
python -m pip install isort
If you want to install from a source distribution, extract the tarball and run the following commands
python setup.py install
You’ll have to install dependencies in a similar way. For debian and rpm packages, use your usual tools according to your Linux distribution.
More information about installation and available distribution format may be found in the user manual in the doc subdirectory.
After these two dependencies installed , try installing pylint again.
I am using a Kivy as a Virtual Machine (in MAC OS). I am trying to install the python packages pycrypto and paramiko. Starting with pycrypto, I tried
pip install pycrypto
Requirement already satisfied: pycrypto in /usr/local/lib/python2.7/dist-packages
but when I try to import it in python
>>> import pycrypto
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named pycrypto
In paramico, I get the following:
kivy#kivy-VirtualBox:~$ pip install paramiko
Collecting paramiko
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
SNIMissingWarning
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
InsecurePlatformWarning
Using cached paramiko-2.1.2-py2.py3-none-any.whl
Requirement already satisfied: pyasn1>=0.1.7 in /usr/local/lib/python2.7/dist-packages (from paramiko)
Collecting cryptography>=1.1 (from paramiko)
Using cached cryptography-1.7.2.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-ZboIFP/cryptography/setup.py", line 334, in <module>
**keywords_with_side_effects(sys.argv)
File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
_setup_distribution = dist = klass(attrs)
File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 320, in __init__
_Distribution.__init__(self, attrs)
File "/usr/lib/python2.7/distutils/dist.py", line 287, in __init__
self.finalize_options()
File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 386, in finalize_options
ep.require(installer=self.fetch_build_egg)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2324, in require
items = working_set.resolve(reqs, env, installer, extras=self.extras)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 859, in resolve
raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.VersionConflict: (six 1.5.2 (/usr/lib/python2.7/dist-packages), Requirement.parse('six>=1.6.0'))
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-ZboIFP/cryptography/
Any suggestions?
From the command line try:
python 2.7 import pycrypto
I'm trying to install the statsmodels, but I'm getting a dependency error that statsmodels requires patsy. However patsy is already installed:
Baby-Whip$ sudo pip install patsy
Downloading/unpacking patsy
Downloading patsy-0.3.0-py2.py3-none-any.whl (224kB): 224kB downloaded
Requirement already satisfied (use --upgrade to upgrade): numpy in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from patsy)
Installing collected packages: patsy
Successfully installed patsy
Cleaning up...
Then when I try to install stasmodels:
Baby-Whip$ sudo pip install statsmodels
Downloading/unpacking statsmodels
Downloading statsmodels-0.5.0.tar.gz (5.5MB): 5.5MB downloaded
Running setup.py (path:/private/tmp/pip_build_root/statsmodels/setup.py) egg_info for package statsmodels
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/private/tmp/pip_build_root/statsmodels/setup.py", line 463, in <module>
check_dependency_versions(min_versions)
File "/private/tmp/pip_build_root/statsmodels/setup.py", line 122, in check_dependency_versions
raise ImportError("statsmodels requires patsy. http://patsy.readthedocs.org")
ImportError: statsmodels requires patsy. http://patsy.readthedocs.org
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 17, in <module>
File "/private/tmp/pip_build_root/statsmodels/setup.py", line 463, in <module>
check_dependency_versions(min_versions)
File "/private/tmp/pip_build_root/statsmodels/setup.py", line 122, in check_dependency_versions
raise ImportError("statsmodels requires patsy. http://patsy.readthedocs.org")
ImportError: statsmodels requires patsy. http://patsy.readthedocs.org
Running pip freeze also lists patsy as an installed package. What am I missing here? Any help would be greatly appreciated.
See above comment for answer. Needed to install six, and run the statmodels install with the above workaround.
Sidenote: kill me