In my Python script I need gssapi as authentication mechanism when applying requests package.
It came to my attention that package requests_gssapi seems promising for my purpose.
After "pip install requests_gssapi" and import it I got this:
>>> from requests_gssapi import HTTPSPNEGOAuth
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\opt\Python36\lib\site-packages\requests_gssapi\__init__.py", line 17, in <module>
from .gssapi_ import HTTPSPNEGOAuth, REQUIRED, OPTIONAL, DISABLED # noqa
File "C:\opt\Python36\lib\site-packages\requests_gssapi\gssapi_.py", line 6, in <module>
import gssapi
File "C:\opt\Python36\lib\site-packages\gssapi\__init__.py", line 29, in <module>
from gssapi.raw.types import NameType, RequirementFlag, AddressType # noqa
File "C:\opt\Python36\lib\site-packages\gssapi\raw\__init__.py", line 50, in <module>
from gssapi.raw.creds import * # noqa
ImportError: DLL load failed: The specified module could not be found.
To me it seemed that extra package needs to be installed, but how?
Please help, thanks
Related
After importing pdblp package I'm getting an error that is described below. I have seen other questions about similar issues with blpapi issues but none of the solutions have worked.
I moved blpapi_64.dll and .lib into working directory from the Bloomberg API website C/C++ experimental download. Reinstalled using Conda python 3.7. twice. Could this be an admin rights issue?
import pdblp as blp
Traceback (most recent call last):
File "<ipython-input-4-37a5527b622a>", line 1, in <module>
import pdblp as blp
File "C:\Users\abunker\AppData\Local\Continuum\anaconda3\lib\site-packages\pdblp\__init__.py", line 1, in <module>
from .pdblp import BCon # NOQA
File "C:\Users\abunker\AppData\Local\Continuum\anaconda3\lib\site-packages\pdblp\pdblp.py", line 4, in <module>
import blpapi
File "C:\Users\abunker\blpapi\__init__.py", line 5, in <module>
from .internals import CorrelationId
File "C:\Users\abunker\blpapi\internals.py", line 50, in <module>
_internals = swig_import_helper()
File "C:\Users\abunker\blpapi\internals.py", line 42, in swig_import_helper
import _internals
ModuleNotFoundError: No module named '_internals'
I'm trying to start with ANTLR . When I import module antlr it's working just fine , but if I try to import MyGrammarLexer and MyGrammarParser , it's shows that MyGrammarLexer and Parser aren't in lib. I Using PyCharm , I installed ANTLR with : pip3 install antlr4-python3-runtime my code is :
import sys
from antlr4 import *
import MyGrammarLexer
import MyGrammarParser
def main(argv):
input = FileStream(argv[1])
lexer = MyGrammarLexer(input)
stream = CommonTokenStream(lexer)
parser = MyGrammarParser(stream)
tree = parser.startRule()
if __name__ == '__main__':
main(sys.argv)
Maybe whom know why i can't import MyGrammarLexer and MyGrammarParser?
Please suggest!
Tackback:
/usr/bin/python3.6 /home/andrejka/PycharmProjects/Parser/parser.py
Traceback (most recent call last):
File "/home/andrejka/PycharmProjects/Parser/parser.py", line 2, in <module>
from antlr4 import *
File "/usr/lib/python3/dist-packages/antlr4/__init__.py", line 5, in <module>
from antlr4.BufferedTokenStream import TokenStream
File "/usr/lib/python3/dist-packages/antlr4/BufferedTokenStream.py", line 19, in <module>
from antlr4.error.Errors import IllegalStateException
File "/usr/lib/python3/dist-packages/antlr4/error/Errors.py", line 5, in <module>
from antlr4.atn.Transition import PredicateTransition
File "/usr/lib/python3/dist-packages/antlr4/atn/Transition.py", line 19, in <module>
from __builtin__ import unicode
ModuleNotFoundError: No module named '__builtin__'
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 23, in <module>
import apt
File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Original exception was:
Traceback (most recent call last):
File "/home/andrejka/PycharmProjects/Parser/parser.py", line 2, in <module>
from antlr4 import *
File "/usr/lib/python3/dist-packages/antlr4/__init__.py", line 5, in <module>
from antlr4.BufferedTokenStream import TokenStream
File "/usr/lib/python3/dist-packages/antlr4/BufferedTokenStream.py", line 19, in <module>
from antlr4.error.Errors import IllegalStateException
File "/usr/lib/python3/dist-packages/antlr4/error/Errors.py", line 5, in <module>
from antlr4.atn.Transition import PredicateTransition
File "/usr/lib/python3/dist-packages/antlr4/atn/Transition.py", line 19, in <module>
from __builtin__ import unicode
ModuleNotFoundError: No module named '__builtin__'
I ran into this problem recently when getting the same error using the pddlpy python library. I was able to fix it by doing the following:
pip3 install antlr4-python3-runtime==4.9
The version 4.9 at the end is very important.
I found out that content of the package:
https://pypi.python.org/packages/0b/6b/30c5b84d203b62e1412d14622e3bae6273399d79d20f3a24c8145213f610/antlr4-python3-runtime-4.7.tar.gz#md5=190245a0fb4abf43568489a4b6e33aba
is different from the package installed by pip3.
I have replaced content of:
~/anaconda3/envs/py3/lib/python3.6/site-packages/antlr4
with content from the package I have downloaded and extracted manually:
~/Downloads/antlr4-python3-runtime-4.7/src/antlr4
It seems to be working now - in particular the following error:
ModuleNotFoundError: No module named '__builtin__'
does not occur.
After posting your traceback I can see the error is:
ModuleNotFoundError: No module named '__builtin__'
That means the package you try to import is using python2 syntax, but you're using python3.
You should use python2 if you need to run this package, but keep in mind that you probably want to search for a different one if this is a new project.
More about why it's not working here
EDIT
They released a package with python3 support, but it seems you installed/used something different. You should verify it.
I tried to reinstall and reinstall three times, I tried to pip3 install --upgrade as well, simply no method I tried didn't worked. When I try to import twython or python twitter, I get this error message:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/user/Documents/Project Lib/python-twitter/twitter/__init__.py", line 56, in <module>
from .api import Api # noqa
File "/home/user/Document/Project Lib/python-twitter/twitter/api.py", line 29, in <module>
from requests_oauthlib import OAuth1
File "/usr/local/lib/python3.4/dist-packages/requests_oauthlib/__init__.py", line 3, in <module>
from .oauth2_auth import OAuth2
File "/usr/local/lib/python3.4/dist-packages/requests_oauthlib/oauth2_auth.py", line 3, in <module>
from oauthlib.oauth2 import is_secure_transport
ImportError: cannot import name 'is_secure_transport'
ps: This only happens on Python3, on Python2x all works fine.
I am really new to python and I am trying to install the statsmodels module. It seems that since I am on a 64 bits I need to use the following unofficial website http://www.lfd.uci.edu/ I did all I know about how to download a whl and I did download it and used the pip afterwards and all work fine. now when I do pip install statsmodels it work fine. However, in my shell after I try import the stats models I am getting
import statsmodels
Traceback (most recent call last): File "<pyshell#7>", line 1, in <module>
import statsmodels File "D:\Python34\lib\site-packages\statsmodels\__init__.py", line 8, in <module>
from .tools.sm_exceptions import (ConvergenceWarning, CacheWriteWarning, File "D:\Python34\lib\site-packages\statsmodels\tools\__init__.py", line 1, in <module>
from .tools import add_constant, categorical File "D:\Python34\lib\site-packages\statsmodels\tools\tools.py", line 8, in <module>
from scipy.linalg import svdvals File "D:\Python34\lib\site-packages\scipy\linalg\__init__.py", line 174, in <module>
from .misc import * File "D:\Python34\lib\site-packages\scipy\linalg\misc.py", line 5, in <module>
from .blas import get_blas_funcs File "D:\Python34\lib\site-packages\scipy\linalg\blas.py", line 155, in <module>
from scipy.linalg import _fblas ImportError: DLL load failed: The specified module could not be found.
Any help would be much appreciated.
Thank you in advance
I am programming in Python 3.3 on the latest version of Ubuntu. I am writing code for a project involving a library that works with Twitter. Here is the output from the terminal I have:
Traceback (most recent call last):
File "tryout.py", line 2, in <module>
import twitter
File "/home/owner/Documents/twitter/__init__.py", line 15, in <module>
from .stream import TwitterStream
File "/home/owner/Documents/twitter/stream.py", line 9, in <module>
from ssl import SSLError
File "/usr/local/lib/python3.3/ssl.py", line 60, in <module>
import _ssl # if we can't import it, let the error propagate
ImportError: No module named '_ssl'
I've been looking around to find a solution for the _ssl error but can't seem to find one that I could follow.