I was trying to use Scrapy with Python 2 and I got this error,
File "/Library/Python/2.7/site-packages/twisted/internet/defer.py", line 1386, in _inlineCallbacks
result = g.send(result)
File "/Library/Python/2.7/site-packages/scrapy/crawler.py", line 95, in crawl
six.reraise(*exc_info)
File "/Library/Python/2.7/site-packages/scrapy/crawler.py", line 77, in crawl
self.engine = self._create_engine()
File "/Library/Python/2.7/site-packages/scrapy/crawler.py", line 102, in _create_engine
return ExecutionEngine(self, lambda _: self.stop())
File "/Library/Python/2.7/site-packages/scrapy/core/engine.py", line 69, in __init__
self.downloader = downloader_cls(crawler)
File "/Library/Python/2.7/site-packages/scrapy/core/downloader/__init__.py", line 88, in __init__
self.middleware = DownloaderMiddlewareManager.from_crawler(crawler)
File "/Library/Python/2.7/site-packages/scrapy/middleware.py", line 58, in from_crawler
return cls.from_settings(crawler.settings, crawler)
File "/Library/Python/2.7/site-packages/scrapy/middleware.py", line 34, in from_settings
mwcls = load_object(clspath)
File "/Library/Python/2.7/site-packages/scrapy/utils/misc.py", line 44, in load_object
mod = import_module(module)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/Library/Python/2.7/site-packages/scrapy/downloadermiddlewares/httpproxy.py", line 4, in <module>
from urllib2 import _parse_proxy
ImportError: cannot import name _parse_proxy
I have urllib2 installed
Name: urllib2
Version: 1498656401.94
Summary: Checking out the typosquatting state of PyPi
Home-page: https://github.com/benjaoming
Author: Benjamin Bach
Author-email: benjamin#overtag.dk
License: MIT
Location: /usr/local/lib/python2.7/site-packages
Requires:
I have tried uninstalling and reinstalling urllib2 and requests.
You probably have two different Python environments. Scrapy seems to live in /Library/Python/2.7/site-packages/scrapy while your urllib2 lives in /usr/local/lib/python2.7/site-packages.
Related
When I start the tutorial it shows an error. I am using windows 11 64 bit. I installed all the packages through anaconda, and I can’t understand what the problem could be. (Python 3.9)
Traceback (most recent call last):
File "C:\Users\iirof\PycharmProjects\rf_detect_mob\yolov7-custom\train.py", line 24, in <module>
import test # import test.py to get mAP after each epoch
File "C:\Users\iirof\PycharmProjects\rf_detect_mob\yolov7-custom\test.py", line 12, in <module>
from models.experimental import attempt_load
File "C:\Users\iirof\PycharmProjects\rf_detect_mob\yolov7-custom\models\experimental.py", line 6, in <module>
from models.common import Conv, DWConv
File "C:\Users\iirof\PycharmProjects\rf_detect_mob\yolov7-custom\models\common.py", line 17, in <module>
from utils.plots import color_list, plot_one_box
File "C:\Users\iirof\PycharmProjects\rf_detect_mob\yolov7-custom\utils\plots.py", line 19, in <module>
from scipy.signal import butter, filtfilt
File "C:\Users\iirof\anaconda3\envs\rf\lib\site-packages\scipy\signal\__init__.py", line 309, in <module>
from . import _sigtools, windows
File "C:\Users\iirof\anaconda3\envs\rf\lib\site-packages\scipy\signal\windows\__init__.py", line 41, in <module>
from ._windows import *
File "C:\Users\iirof\anaconda3\envs\rf\lib\site-packages\scipy\signal\windows\_windows.py", line 7, in <module>
from scipy import linalg, special, fft as sp_fft
File "C:\Users\iirof\anaconda3\envs\rf\lib\site-packages\scipy\__init__.py", line 233, in __getattr__
return _importlib.import_module(f'scipy.{name}')
File "C:\Users\iirof\anaconda3\envs\rf\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "C:\Users\iirof\anaconda3\envs\rf\lib\site-packages\scipy\linalg\__init__.py", line 197, in <module>
from ._misc import *
File "C:\Users\iirof\anaconda3\envs\rf\lib\site-packages\scipy\linalg\_misc.py", line 3, in <module>
from .blas import get_blas_funcs
File "C:\Users\iirof\anaconda3\envs\rf\lib\site-packages\scipy\linalg\blas.py", line 213, in <module>
from scipy.linalg import _fblas
ImportError: DLL load failed while importing _fblas: %1 не является приложением Win32.
Tried to install different versions of python, but nothing new.
Currently we are on Python 2.7.17, and we are getting the following error:
sbdsvrwm261# ./pip install pandas
Traceback (most recent call last):
File "./pip", line 9, in <module>
load_entry_point('pip==8.1.2', 'console_scripts', 'pip')()
File "/opt/csw/lib/python2.7/site-packages/pkg_resources/__init__.py", line 565, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/opt/csw/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2631, in load_entry_point
return ep.load()
File "/opt/csw/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2291, in load
return self.resolve()
File "/opt/csw/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2297, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/opt/csw/lib/python2.7/site-packages/pip/__init__.py", line 16, in <module>
from pip.vcs import git, mercurial, subversion, bazaar # noqa
File "/opt/csw/lib/python2.7/site-packages/pip/vcs/subversion.py", line 9, in <module>
from pip.index import Link
File "/opt/csw/lib/python2.7/site-packages/pip/index.py", line 30, in <module>
from pip.wheel import Wheel, wheel_ext
File "/opt/csw/lib/python2.7/site-packages/pip/wheel.py", line 39, in <module>
from pip._vendor.distlib.scripts import ScriptMaker
File "/opt/csw/lib/python2.7/site-packages/pip/_vendor/distlib/scripts.py", line 14, in <module>
from .compat import sysconfig, detect_encoding, ZipFile
File "/opt/csw/lib/python2.7/site-packages/pip/_vendor/distlib/compat.py", line 31, in <module>
from urllib2 import (Request, urlopen, URLError, HTTPError,
ImportError: cannot import name HTTPSHandler
If you require further information from me, please let me know.
Thanks
Pandas officially supports Python ^3.5.3.
Have you tried using virtualenv or docker to get Python 3.*?
I am running tensorflow within a microservice built using Klein/Twisted. I recently upgraded to a new version of scikit-learn (20.0), and am getting an error ValueError: bad value(s) in fds_to_keep. When I revert the version of scikit-learn to 19.2 the error is eliminated. I looked at the changelog for scikit-learn, and in version 20.0 they started using joblib for parallel computation. Below I am including a stack trace for the error. I am using Twisted version 19.7.
Any insights or advice on how to debug further is much appreciated.
I have tried newer versions of scikit-learn e.g.21.3, but the error remains.
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/calamari_ocr/ocr/predictor.py", line 106, in __init__
backend = create_backend_from_proto(self.network_params, restore=self.checkpoint, processes=processes)
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/calamari_ocr/ocr/backends/factory.py", line 28, in create_backend_from_proto
from calamari_ocr.ocr.backends.tensorflow_backend.tensorflow_backend import TensorflowBackend
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/calamari_ocr/ocr/backends/tensorflow_backend/tensorflow_backend.py", line 4, in <module>
from calamari_ocr.ocr.backends.tensorflow_backend.tensorflow_model import TensorflowModel
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/calamari_ocr/ocr/backends/tensorflow_backend/tensorflow_model.py", line 3, in <module>
import tensorflow.contrib.cudnn_rnn as cudnn_rnn
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/tensorflow/contrib/__init__.py", line 37, in <module>
from tensorflow.contrib import cudnn_rnn
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/tensorflow/contrib/cudnn_rnn/__init__.py", line 38, in <module>
from tensorflow.contrib.cudnn_rnn.python.layers import *
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/tensorflow/contrib/cudnn_rnn/python/layers/__init__.py", line 23, in <module>
from tensorflow.contrib.cudnn_rnn.python.layers.cudnn_rnn import *
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/tensorflow/contrib/cudnn_rnn/python/layers/cudnn_rnn.py", line 20, in <module>
from tensorflow.contrib.cudnn_rnn.python.ops import cudnn_rnn_ops
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/tensorflow/contrib/cudnn_rnn/python/ops/cudnn_rnn_ops.py", line 22, in <module>
from tensorflow.contrib.rnn.python.ops import lstm_ops
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/tensorflow/contrib/rnn/__init__.py", line 93, in <module>
from tensorflow.contrib.rnn.python.ops.rnn_cell import *
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/tensorflow/contrib/rnn/python/ops/rnn_cell.py", line 24, in <module>
from tensorflow.contrib.layers.python.layers import layers
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/tensorflow/contrib/layers/__init__.py", line 116, in <module>
from tensorflow.contrib.layers.python.layers import *
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/tensorflow/contrib/layers/python/layers/__init__.py", line 33, in <module>
from tensorflow.contrib.layers.python.layers.target_column import *
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/tensorflow/contrib/layers/python/layers/target_column.py", line 24, in <module>
from tensorflow.contrib.losses.python.losses import loss_ops
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/tensorflow/contrib/losses/__init__.py", line 25, in <module>
from tensorflow.contrib.losses.python import metric_learning
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/tensorflow/contrib/losses/python/metric_learning/__init__.py", line 25, in <module>
from tensorflow.contrib.losses.python.metric_learning.metric_loss_ops import *
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/tensorflow/contrib/losses/python/metric_learning/metric_loss_ops.py", line 34, in <module>
from sklearn import metrics
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/sklearn/__init__.py", line 76, in <module>
from .base import clone
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/sklearn/base.py", line 16, in <module>
from .utils import _IS_32BIT
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/sklearn/utils/__init__.py", line 17, in <module>
from . import _joblib
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/sklearn/utils/_joblib.py", line 8, in <module>
import joblib
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/joblib/__init__.py", line 119, in <module>
from .parallel import Parallel
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/joblib/parallel.py", line 22, in <module>
from ._multiprocessing_helpers import mp
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/site-packages/joblib/_multiprocessing_helpers.py", line 34, in <module>
_sem = Semaphore()
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/multiprocessing/context.py", line 82, in Semaphore
return Semaphore(value, ctx=self.get_context())
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/multiprocessing/synchronize.py", line 127, in __init__
SemLock.__init__(self, SEMAPHORE, value, SEM_VALUE_MAX, ctx=ctx)
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/multiprocessing/synchronize.py", line 81, in __init__
register(self._semlock.name)
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/multiprocessing/semaphore_tracker.py", line 83, in register
self._send('REGISTER', name)
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/multiprocessing/semaphore_tracker.py", line 90, in _send
self.ensure_running()
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/multiprocessing/semaphore_tracker.py", line 71, in ensure_running
pid = util.spawnv_passfds(exe, args, fds_to_pass)
File "/home/ppiela/anaconda3/envs/visual_extraction_validation/lib/python3.6/multiprocessing/util.py", line 403, in spawnv_passfds
False, False, None)
ValueError: bad value(s) in fds_to_keep
I'm using Rasa for a chatbot project and recently completed the installation. When I try to train my bot using the 'rasa train' command, it shows me this error and I cant seem to find a way to solve it.
I've reinstalled tensorflow as suggested on another forum, but it didnt make a difference
Traceback (most recent call last):
File "c:\users\rithesh\anaconda3_update\envs\tf_gpu\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\rithesh\anaconda3_update\envs\tf_gpu\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\Rithesh\Anaconda3_update\envs\tf_gpu\Scripts\rasa.exe\__main__.py", line 9, in <module>
File "c:\users\rithesh\anaconda3_update\envs\tf_gpu\lib\site-packages\rasa\__main__.py", line 69, in main
set_log_level(log_level)
File "c:\users\rithesh\anaconda3_update\envs\tf_gpu\lib\site-packages\rasa\utils\common.py", line 68, in set_log_level
update_tensorflow_log_level()
File "c:\users\rithesh\anaconda3_update\envs\tf_gpu\lib\site-packages\rasa\utils\common.py", line 87, in update_tensorflow_log_level
import tensorflow as tf
File "c:\users\rithesh\anaconda3_update\envs\tf_gpu\lib\site-packages\tensorflow\__init__.py", line 29, in <module>
from tensorflow._api.v1 import compat
File "c:\users\rithesh\anaconda3_update\envs\tf_gpu\lib\site-packages\tensorflow\_api\v1\compat\__init__.py", line 21, in <module>
from tensorflow._api.v1.compat import v1
File "c:\users\rithesh\anaconda3_update\envs\tf_gpu\lib\site-packages\tensorflow\_api\v1\compat\v1\__init__.py", line 626, in <module>
child_package_str=('tensorflow_estimator.python.estimator.api.estimator'))
File "c:\users\rithesh\anaconda3_update\envs\tf_gpu\lib\site-packages\tensorflow\python\tools\component_api_helper.py", line 56, in package_hook
child_pkg = importlib.import_module(child_package_str)
File "c:\users\rithesh\anaconda3_update\envs\tf_gpu\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "c:\users\rithesh\anaconda3_update\envs\tf_gpu\lib\site-packages\tensorflow_estimator\__init__.py", line 8, in <module>
from tensorflow_estimator._api.v1 import estimator
File "c:\users\rithesh\anaconda3_update\envs\tf_gpu\lib\site-packages\tensorflow_estimator\_api\v1\estimator\__init__.py", line 8, in <module>
from tensorflow_estimator._api.v1.estimator import experimental
File "c:\users\rithesh\anaconda3_update\envs\tf_gpu\lib\site-packages\tensorflow_estimator\_api\v1\estimator\experimental\__init__.py", line 8, in <module>
from tensorflow_estimator.python.estimator.canned.dnn import dnn_logit_fn_builder
File "c:\users\rithesh\anaconda3_update\envs\tf_gpu\lib\site-packages\tensorflow_estimator\python\estimator\__init__.py", line 25, in <module>
import tensorflow_estimator.python.estimator.estimator_lib
File "c:\users\rithesh\anaconda3_update\envs\tf_gpu\lib\site-packages\tensorflow_estimator\python\estimator\estimator_lib.py", line 22, in <module>
from tensorflow_estimator.python.estimator.canned.baseline import BaselineClassifier
File "c:\users\rithesh\anaconda3_update\envs\tf_gpu\lib\site-packages\tensorflow_estimator\python\estimator\canned\baseline.py", line 67, in <module>
from tensorflow_estimator.python.estimator import estimator
File "c:\users\rithesh\anaconda3_update\envs\tf_gpu\lib\site-packages\tensorflow_estimator\python\estimator\estimator.py", line 37, in <module>
from tensorflow.python.eager import monitoring
File "c:\users\rithesh\anaconda3_update\envs\tf_gpu\lib\site-packages\tensorflow\python\eager\monitoring.py", line 31, in <module>
create=pywrap_tensorflow.TFE_MonitoringNewCounter0,
AttributeError: module 'tensorflow.python.pywrap_tensorflow' has no attribute 'TFE_MonitoringNewCounter0'
Did you read this already?
AttributeError: module 'tensorflow.python.pywrap_tensorflow' has no attribute 'TFE_Py_RegisterExceptionClass'
In my experience a clean conda environment goes a long way. Also the order in which you type your conda install commands matters.
I followed the instruction from here:
file:///home/bioinfo/Descargas/pdfminer3k-1.3.0/docs/index.html
after download pdfminer3k-1.3.0 I did:
python setup.py install
But when I do
pdf2txt.py samples/simple1.pdf
And it doesn't read the pdf, the path is ok.
It give me back the error:
>
Traceback (most recent call last):
File "/usr/local/bin/pdf2txt.py", line 5, in <module>
pkg_resources.run_script('pdfminer3k==1.3.0', 'pdf2txt.py')
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 528, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1394, in run_script
execfile(script_filename, namespace, namespace)
File "/usr/local/lib/python2.7/dist-packages/pdfminer3k-1.3.0-py2.7.egg/EGG-INFO/scripts/pdf2txt.py", line 6, in <module>
from pdfminer.pdfinterp import PDFResourceManager, process_pdf
File "/usr/local/lib/python2.7/dist-packages/pdfminer3k-1.3.0-py2.7.egg/pdfminer/pdfinterp.py", line 5, in <module>
from .cmapdb import CMapDB, CMap
File "/usr/local/lib/python2.7/dist-packages/pdfminer3k-1.3.0-py2.7.egg/pdfminer/cmapdb.py", line 23, in <module>
from .psparser import PSStackParser
File "/usr/local/lib/python2.7/dist-packages/pdfminer3k-1.3.0-py2.7.egg/pdfminer/psparser.py", line 4, in <module>
from .utils import choplist
File "/usr/local/lib/python2.7/dist-packages/pdfminer3k-1.3.0-py2.7.egg/pdfminer/utils.py", line 212, in <module>
0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x00ff,
File "/usr/local/lib/python2.7/dist-packages/pdfminer3k-1.3.0-py2.7.egg/pdfminer/utils.py", line 180, in <genexpr>
PDFDocEncoding = ''.join( chr(x) for x in (
ValueError: chr() arg not in range(256)
Is it any solution?
The latest code (version 20140328) uses unichr(). Try this instead:
pip install pdfminer==20140328
Or download from https://pypi.python.org/pypi/pdfminer/20140328.