pdblp package is giving "No module named _internal" - python

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'

Related

library importing issues in pycharm

I'm doing a project on opencv python which is based on downloaded source code from the internet. When I run the code, this error occurs
C:\Users\Udara\AppData\Local\Programs\Python\Python38-32\python.exe C:/Users/Udara/Desktop/7777/people-counting-opencv/people_counter.py
Traceback (most recent call last):
File "C:/Users/Udara/Desktop/7777/people-counting-opencv/people_counter.py", line 13, in <module>
from pyimagesearch.centroidtracker import CentroidTracker
File "C:\Users\Udara\Desktop\7777\people-counting-opencv\pyimagesearch\centroidtracker.py", line 5, in <module>
import ordereddict
File "C:\Users\Udara\AppData\Local\Programs\Python\Python38-32\lib\site-packages\ordereddict.py", line 23, in <module>
from UserDict import DictMixin
ModuleNotFoundError: No module named 'UserDict'

DLL failed to load issue when using requests_gssapi, Python

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

Resolve AttributeError: module 'pandas' has no attribute 'core' using command-prompt or pycharm

I am struggling because of the error
AttributeError: module 'pandas' has no attribute 'core'
since quite a long time please refer the output of "import pandas" below. I have searched for this error on the net and searched at many places tried many things but was unable to resolve it. The problem was the solutions provided were more realted to other operating systems like Mac and Linux while I am using Windows 7 Professional.
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\__init__.py", line 42, in <module>
from pandas.core.api import *
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\api.py", line 10, in <module>
from pandas.core.groupby.groupby import Grouper
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\groupby\__init__.py", line 2, in <module>
from pandas.core.groupby.groupby import (
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\groupby\groupby.py", line 49, in <module>
from pandas.core.frame import DataFrame
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\frame.py", line 74, in <module>
from pandas.core.series import Series
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\series.py", line 66, in <module>
import pandas.core.ops as ops
AttributeError: module 'pandas' has no attribute 'core'
Please do ask if you need any other details. I will be really gratified if you help me through this.
Thankyou
P.S if you can suggest a solution which does not use internet using terminal such as in case of "pip install pandas" as the company's network access is restricted. So, I installed all the dependencies of pandas through whl files which are downloadable through the access the company has provided.
Edit: The first time I execute pandas it shows and rest it shows the error shown above
>>> import pandas
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\__init__.py", line 42, in <module>
from pandas.core.api import *
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\api.py", line 10, in <module>
from pandas.core.groupby.groupby import Grouper
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\groupby\__init__.py", line 2, in <module>
from pandas.core.groupby.groupby import (
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\groupby\groupby.py", line 49, in <module>
from pandas.core.frame import DataFrame
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\frame.py", line 74, in <module>
from pandas.core.series import Series
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\series.py", line 3978, in <module>
Series._add_series_or_dataframe_operations()
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\generic.py", line 8891, in _add_series_or_dataframe_operations
from pandas.core import window as rwindow
File "C:\Users\IshanL\PycharmProjects\Project1\venv\lib\site-packages\pandas\core\window.py", line 36, in <module>
import pandas._libs.window as _window
ImportError: DLL load failed: The specified module could not be found.
conda upgrade --all
Upgrade your library and restart your notebook.This will do the work.

Can't import module ANTLR MyGrammarLexer and MyGrammarParser

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.

Import error with module _ssl for Python 3.3

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.

Categories

Resources