ImportError: cannot import name iocpsupport - python

I am using twisted API and getting following error
Traceback (most recent call last):
File "C:\Documents and Settings\ggne0622\Desktop\Python\google-python-exercises\babynames\SimpleAgent.py", line 16, in <module>
from twisted.internet.iocpreactor import reactor
File "C:\Python27\Lib\site-packages\twisted\internet\iocpreactor\__init__.py", line 8, in <module>
from twisted.internet.iocpreactor.reactor import install
File "C:\Python27\Lib\site-packages\twisted\internet\iocpreactor\reactor.py", line 17, in <module>
from twisted.internet.iocpreactor import iocpsupport as _iocp
ImportError: cannot import name iocpsupport

It looks like you installed Twisted without building the IOCP extensions. Either build them (requires a version of MSVC compatible with your Python installation) or use a binary installer - eg one of the several on https://pypi.python.org/pypi/Twisted

Related

I am trying to use module requests in python and it is simply not working

My issue
i have downloaded chardet, requests, typing, binary io, and django modules in an effort to fix whatever issue i am having while importing python module requests.
I also reainstalled python with the standard group of python modules option. I dont know what the issue is please help. Thank you.
Further information
Python 3.9
Installed using pip
The code:
import requests
Below is the error log:
Traceback (most recent call last):
File "C:\PROGRA~1\IBM\SPSS\STATIS~1\26\Python3\Lib\site-packages\requests\compat.py", line 12, in <module>
import chardet
ImportError: No module named 'chardet'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import requests
File "C:\PROGRA~1\IBM\SPSS\STATIS~1\26\Python3\Lib\site-packages\requests\__init__.py", line 45, in <module>
from .exceptions import RequestsDependencyWarning
File "C:\PROGRA~1\IBM\SPSS\STATIS~1\26\Python3\Lib\site-packages\requests\exceptions.py", line 11, in <module>
from .compat import JSONDecodeError as CompatJSONDecodeError
File "C:\PROGRA~1\IBM\SPSS\STATIS~1\26\Python3\Lib\site-packages\requests\compat.py", line 14, in <module>
import charset_normalizer as chardet
File "C:\PROGRA~1\IBM\SPSS\STATIS~1\26\Python3\Lib\site-packages\charset_normalizer\__init__.py", line 24, in <module>
from .api import from_bytes, from_fp, from_path, normalize
File "C:\PROGRA~1\IBM\SPSS\STATIS~1\26\Python3\Lib\site-packages\charset_normalizer\api.py", line 3, in <module>
from typing import BinaryIO, List, Optional, Set
ImportError: No module named 'typing'
I have found the issue after checking everything using pip. All modules up to date python up to date pip up to date. However despite completely uninstalling and reinstalling setuptools was out of date. so i updated setuptools with pip.
to find out whats out of date with pip:
pip list --outdated

Error Importing Pyro after source install for Anaconda release of Python

I downloaded Pyro using source install instructions here under the Install from source link because I was always told not to use pip when installing to an Anaconda installation. When I try import pyro I get the attribute error below which does not make sense
import pyro
Traceback (most recent call last):
File "<ipython-input-48-05a8cb49cc0d>", line 1, in <module>
import pyro
File "C:\Users\bjwil\Anaconda3\Lib\site-packages\pyro\__init__.py", line 6, in <module>
from pyro.primitives import (clear_param_store, enable_validation, get_param_store, iarange, irange, module, param,
File "C:\Users\bjwil\Anaconda3\Lib\site-packages\pyro\primitives.py", line 10, in <module>
import pyro.infer as infer
File "C:\Users\bjwil\Anaconda3\Lib\site-packages\pyro\infer\__init__.py", line 14, in <module>
from pyro.infer.traceenum_elbo import JitTraceEnum_ELBO, TraceEnum_ELBO
File "C:\Users\bjwil\Anaconda3\Lib\site-packages\pyro\infer\traceenum_elbo.py", line 183, in <module>
class BackwardSampleMessenger(pyro.poutine.messenger.Messenger):
AttributeError: module 'pyro.poutine' has no attribute 'messenger'
This doesn't make much sense because in the poutine folder I have the messenger file and it has the Class Messenger so line 183 class BackwardSampleMessenger(pyro.poutine.messenger.Messenger) in the traceenum_elbo.py file should be working.

ImportError: cannot import name chardet

Hi i have written a python scraper in which i am importing requests and Beautiful soup module . I am using python2.7 .
I am crating Windows executable (.exe) from my Python script using py2exe module.
For that i have created setup.py as following :
from distutils.core import setup
import py2exe
import requests
packages = [
'requests',
'requests.packages',
'requests.packages.chardet',
'requests.packages.urllib3',
'requests.packages.urllib3.packages',
'requests.packages.urllib3.contrib',
'requests.packages.urllib3.util',
'requests.packages.urllib3.packages.ssl_match_hostname',
]
setup(
console=['CompanyScraper-1.6.py']
)
I have created .exe file by running command "python setup.py py2exe".
But while running the .exe file on window it throwing following error:
Traceback (most recent call last):
File "CompanyScraper-1.6.py", line 13, in <module>
File "requests\__init__.pyc", line 58, in <module>
File "requests\utils.pyc", line 26, in <module>
File "requests\compat.pyc", line 7, in <module>
ImportError: cannot import name chardet
i could not undaerstand why this chardet import error though i have included package into setup.py
Thanks you for looking into my issue.
As you can see from the traceback -
Traceback (most recent call last):
File "CompanyScraper-1.6.py", line 13, in <module>
File "requests\__init__.pyc", line 58, in <module>
File "requests\utils.pyc", line 26, in <module>
File "requests\compat.pyc", line 7, in <module>
ImportError: cannot import name chardet
You have a requests directory with a __init__.py . This is masking the requests package from the library , so when you try to import chardet or any such thing from requests library , it tries to search for it in this local package, and not the library one.
The best solution for this would be to rename the directory and your local package from requests to something else, so that the name does not conflict with any library packages.

py2neo offline install failing

I'm trying to install py2neo on an offline machine. I can't use pip because I'm not connected to the internet. I'm trying to install py2neo-2.0.3 with python2.7.9 on redhat. When I run python setup.py install I get ImportError: cannot import name HTTPSConnection.
Traceback (most recent call last):
File "setup.py", line 29, in <module>
from py2neo import __author__, __email__, __license__, __package__, __version__
File "usr/lib/py2neo-2.0.3/py2neo/__init__.py" line 27, in <module>
from py2neo.core import *
File "usr/lib/py2neo-2.0.3/py2neo/core.py", line 28, in <module>
from py2neo.env import NEO4J_AUTH_TOKEN, NEO4J_URI
File "usr/lib/py2neo-2.0.3/py2neo/env.py", line 21, in <module>
from py2neo.packages.httpstream.packages.urimagic import URI
File "usr/lib/py2neo-2.0.3/py2neo/packages/httpstream/__init__.py", line 32, in <module>
from .http import *
File "usr/lib/py2neo-2.0.3/py2neo/packages/httpstream/http.py", line 31, in <module>
from httplib import (BadStatusLine, CannotSendRequest,
ImportError: cannot import name HTTPSConnection
I've tried installing httpstream but that didn't fix the import error.
HTTPSConnection should come with the standard library and isn't part of py2neo itself:
https://docs.python.org/2/library/httplib.html#httplib.HTTPSConnection
I don't know specifically about how RedHat package Python but it's possible you need to install SSL support in addition to the main language. I believe this is a separate compilation option:
http://www.webtop.com.au/blog/compiling-python-with-ssl-support-fedora-10-2009020237

Getting errors when trying to import pymc

I have installed pymc using easy_install pymc command. While I try to import the package using import pymc.
I am getting following errors :
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/pymc-2.3.2-py2.7-linux-i686.egg/pymc/__init__.py", line 29, in <module>
from .CommonDeterministics import *
File "/usr/local/lib/python2.7/dist-packages/pymc-2.3.2-py2.7-linux-i686.egg/pymc/CommonDeterministics.py", line 21, in <module>
from .utils import safe_len, stukel_logit, stukel_invlogit, logit, invlogit, value, find_element
File "/usr/local/lib/python2.7/dist-packages/pymc-2.3.2-py2.7-linux-i686.egg/pymc/utils.py", line 14, in <module>
from . import flib
ImportError: libatlas.so.3gf: cannot open shared object file: No such file or directory
I am using Ubuntu 12.04 and Python 2.7.
What is the reason for these errors?
Try installing that missing library:
apt-get install libatlas3-base-dev

Categories