unknown version in python library pyparsing - python

I am trying to install airnotifier on my machine, I am getting this error
My python version is 3.6
PS C:\airnotifier> python app.py
Traceback (most recent call last):
File "app.py", line 32, in <module>
from pushservices.bootstrap import init_messaging_agents
File "C:\airnotifier\pushservices\bootstrap.py", line 4, in <module>
from .fcm import FCMClient
File "C:\airnotifier\pushservices\fcm.py", line 5, in <module>
from oauth2client.service_account import ServiceAccountCredentials
File "C:\Users\smacrsadmin\AppData\Local\Programs\Python\Python36\lib\site-packages\oauth2client\service_account.py", line 25, in <module>
from oauth2client import client
File "C:\Users\smacrsadmin\AppData\Local\Programs\Python\Python36\lib\site-packages\oauth2client\client.py", line 39, in <module>
from oauth2client import transport
File "C:\Users\smacrsadmin\AppData\Local\Programs\Python\Python36\lib\site-packages\oauth2client\transport.py", line 17, in <module>
import httplib2
File "C:\Users\smacrsadmin\AppData\Local\Programs\Python\Python36\lib\site-packages\httplib2\__init__.py", line 52, in <module>
from . import auth
File "C:\Users\smacrsadmin\AppData\Local\Programs\Python\Python36\lib\site-packages\httplib2\auth.py", line 4, in <module>
import pyparsing as pp
File "C:\Users\smacrsadmin\AppData\Local\Programs\Python\Python36\lib\site-packages\pyparsing\__init__.py", line 130, in <module>
__version__ = __version_info__.__version__
AttributeError: 'version_info' object has no attribute '__version__'

I received the same error and I'm also in Python 3.6.0 ...
AttributeError: 'version_info' object has no attribute '__version__'
If you want to dig a little more, you can type this in your console and detect which package is using this dependency.
> pip show pyparsing
In my case the output was something like this, indicating that packaging:
Name: pyparsing
Version: 2.4.7
Summary: Python parsing module
License: MIT License
Location:
Requires:
Required-by: packaging
To fix it, you can go with the suggestion from PaulMcG
pip install pyparsing==2.4.7
Update 2022-Jun-03:
Reference to the issue
https://github.com/pyparsing/pyparsing/releases/tag/pyparsing_3.0.8
Note says:
API CHANGE: modified pyproject.toml to require Python version 3.6.8 or
later for pyparsing 3.x. Earlier minor versions of 3.6 fail in
evaluating the version_info class (implemented using
typing.NamedTuple). If you are using an earlier version of Python 3.6,
you will need to use pyparsing 2.4.7.

Related

Python Error when importing azure-eventhub on Mac Monterey

I am trying to import following:
from azure.eventhub import EventData
from azure.eventhub.aio import EventHubProducerClient
from azure.eventhub.exceptions import EventHubError
I get error:
from azure.eventhub import EventData
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/azure/eventhub/__init__.py", line 5, in <module>
from ._common import EventData, EventDataBatch
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/azure/eventhub/_common.py", line 24, in <module>
from ._utils import (
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/azure/eventhub/_utils.py", line 33, in <module>
from uamqp import types as uamqp_types
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/uamqp/__init__.py", line 12, in <module>
from uamqp import c_uamqp # pylint: disable=import-self
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/uamqp/c_uamqp.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '_SASToken_CreateString'
>>> from azure.eventhub.aio import EventHubProducerClient
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/azure/eventhub/__init__.py", line 5, in <module>
from ._common import EventData, EventDataBatch
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/azure/eventhub/_common.py", line 24, in <module>
from ._utils import (
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/azure/eventhub/_utils.py", line 33, in <module>
from uamqp import types as uamqp_types
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/uamqp/__init__.py", line 12, in <module>
from uamqp import c_uamqp # pylint: disable=import-self
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/uamqp/c_uamqp.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '_SASToken_CreateString'
>>> from azure.eventhub.exceptions import EventHubError
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/azure/eventhub/__init__.py", line 5, in <module>
from ._common import EventData, EventDataBatch
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/azure/eventhub/_common.py", line 24, in <module>
from ._utils import (
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/azure/eventhub/_utils.py", line 33, in <module>
from uamqp import types as uamqp_types
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/uamqp/__init__.py", line 12, in <module>
from uamqp import c_uamqp # pylint: disable=import-self
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/uamqp/c_uamqp.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '_SASToken_CreateString'
PS- I already did pip install for azure-eventhub. I am running this on Mac M1 machine, with Python: 3.10.6 and pip 22.2.2.
What needs to be fixed/imported to resolve the error?
Try installing uamqp from source instead of wheel/binary.
Remove the eventhub and uamqp libraries first:
pip remove azure-eventhub
pip remove uamqp
Install uamqp from source first:
pip install --no-binary uamqp uamqp
pip install azure-eventhub
This worked for me on my M1. See if this works for you as well.
On Python 3.10 you can update to the latest uamqp package to get Apple M1 support:
pip install -U uamqp
Version 1.6.1 and above will support M1 on Python 3.10 and later
I wanted to provide an update. My team just released a new version of the Event Hubs SDK which is using a new AMQP stack written all in Python and removes the dependency on uamqp. This allows us to support the SDK on multiple platforms with no breaking changes. You can pip install azure-eventhub >= 5.11.0 to get the latest version. For further information please see the announcement and the readme for backwards compatibility with uamqp

Python modulenotfound error - Is there a "pip" alternative way to install python modules

I am trying to run a program (obviously written in python) and it requires some python modules. One of the missed modules is aiomultiprocess. I tried installing it with pip install aiomultiprocess pip3 install aiomultiprocess python3.7 -m pip install aiomultiprocess but they all come back with the same error message:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python3.7/site-packages/setuptools/__init__.py", line 19, in <module>
from setuptools.dist import Distribution
File "/usr/local/lib/python3.7/site-packages/setuptools/dist.py", line 34, in <module>
from setuptools import windows_support
File "/usr/local/lib/python3.7/site-packages/setuptools/windows_support.py", line 2, in <module>
import ctypes
File "/usr/local/lib/python3.7/ctypes/__init__.py", line 10, in <module>
from _ctypes import Union, Structure, Array
File "/usr/local/lib/python3.7/_ctypes.py", line 5, in <module>
import ffi
ModuleNotFoundError: No module named 'ffi'
No ffi module?! Let's get it!
I looked it up and figured it's a foreign library that come, in the case of python, as 2 forms: CFFI & LibFFI, but "ffi" doesn't exist for python. I installed cffi libffi and added them to this path /usr/local/lib/python3.7/site-packages/, but it changed nothing.
So my question is there another way to install python modules without the need of pip??!

python docker throws error: AttributeError: module 'six' has no attribute 'PY34'

I'm writing a script which will build the docker image and then push the image to ECR.
my current python version is
>python --version
Python 3.8.0
so, for some reason, at the first line while running my python at local, I'm getting below error. Saying this means, it has not yet build the image to push into the ECR.
import docker --> throws below error
Traceback (most recent call last):
File "genericECR.py", line 1, in <module>
import docker
File "C:\Users\AppData\Local\Programs\Python\Python38-32\lib\site-packages\docker\__init__.py", line 2, in <module>
from .api import APIClient
File "C:\Users\AppData\Local\Programs\Python\Python38-32\lib\site-packages\docker\api\__init__.py", line 2, in <module>
from .client import APIClient
File "C:\Users\AppData\Local\Programs\Python\Python38-32\lib\site-packages\docker\api\client.py", line 8, in <module>
import websocket
File "C:\Users\AppData\Local\Programs\Python\Python38-32\lib\site-packages\websocket\__init__.py", line 23, in <module>
from ._app import WebSocketApp
File "C:\Users\AppData\Local\Programs\Python\Python38-32\lib\site-packages\websocket\_app.py", line 36, in <module>
from ._core import WebSocket, getdefaulttimeout
File "C:\Users\AppData\Local\Programs\Python\Python38-32\lib\site-packages\websocket\_core.py", line 34, in <module>
from ._handshake import *
File "C:\Users\AppData\Local\Programs\Python\Python38-32\lib\site-packages\websocket\_handshake.py", line 40, in <module>
if six.PY34:
AttributeError: module 'six' has no attribute 'PY34'
six is already installed
Requirement already satisfied: six in c:\users\appdata\local\programs\python\python38-32\lib\site-packages (1.6.1)
it seems like it is intended for python 34 so for python 38, how can I solve this?
Most probably the six version is not high enough, c.f. https://github.com/docker/docker-py/issues/2294
First check the six version:
import six
print(six.__version__)
If six version is not >=1.0.0, then upgrade six, on command line
python -m pip install -U six
With the latest pip, you should see this:
>>> import six
>>> six.__version__
'1.13.0'
>>> six.PY34
True
it helped, I was having the issue with docker-compose running, that command helped:
python -m pip install -U six

Theano import error: No module named cPickle

>>> import theano
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/theano/__init__.py", line 52, in <module>
from theano.gof import (
File "/Library/Python/2.7/site-packages/theano/gof/__init__.py", line 38, in <module>
from theano.gof.cc import \
File "/Library/Python/2.7/site-packages/theano/gof/cc.py", line 30, in <module>
from theano.gof import link
File "/Library/Python/2.7/site-packages/theano/gof/link.py", line 18, in <module>
from theano.gof.type import Type
File "/Library/Python/2.7/site-packages/theano/gof/type.py", line 17, in <module>
from theano.gof.op import CLinkerObject
File "/Library/Python/2.7/site-packages/theano/gof/op.py", line 25, in <module>
from theano.gof.cmodule import GCC_compiler
File "/Library/Python/2.7/site-packages/theano/gof/cmodule.py", line 8, in <module>
import six.moves.cPickle as pickle
ImportError: No module named cPickle
I'm pretty sure there is no problem with cPickle. Can it be the problem of other dependencies? It's true that I upgraded all the packages this morning, so that a conflict of version may occur. Nonetheless, the problem still exists after I switched to the bleeding-edge version of theano. Would someone help me figure it out?
PS: My developing device is Macbook Pro 13(early 2015); my system version is OS X 10.10.5; python version is 2.7.10
=========================== Second Edit ===================================
It seems I do have latest version of six installed on my Mac.
YiqundeMacBook-Pro:~ Leo$ pip show six
---
Metadata-Version: 2.0
Name: six
Version: 1.9.0
Summary: Python 2 and 3 compatibility utilities
Home-page: http://pypi.python.org/pypi/six/
Author: Benjamin Peterson
Author-email: benjamin#python.org
License: MIT
Location: /Library/Python/2.7/site-packages
Requires:
I had the same problem and upgrading six solved issue:
sudo easy_install --upgrade six
Try to avoid using sudo at all costs. Open a python session and run
import six
print six.__version__
print six.__file__
The version will likely not be most recent (1.10.0), so go manually delete the six.py and six.pyc files at the imported path, and then run pip install six. Python should now be importing the latest version of six, compatible with Theano :)

Error with Crunchbase API wrapper pycrunchbase

I tried importing the pycrunchbase api wrapper and i get the following error.
It is a API wrapper that use the Crunchbase API platform
Doc: https://pycrunchbase.readthedocs.org/en/latest/usage.html
Github: https://github.com/ngzhian/pycrunchbase
>>> from pycrunchbase import *
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
from pycrunchbase import *
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pycrunchbase/__init__.py", line 1, in <module>
from .pycrunchbase import (
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pycrunchbase/pycrunchbase.py", line 4, in <module>
from .resource import (
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pycrunchbase/resource/__init__.py", line 1, in <module>
from .acquisition import Acquisition
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pycrunchbase/resource/acquisition.py", line 3, in <module>
from .node import Node
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pycrunchbase/resource/node.py", line 3, in <module>
from .relationship import NoneRelationshipSingleton, Relationship
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pycrunchbase/resource/relationship.py", line 3, in <module>
from .page import Page
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pycrunchbase/resource/page.py", line 4, in <module>
from .pageitem import PageItem
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pycrunchbase/resource/pageitem.py", line 58, in <module>
#six.python_2_unicode_compatible
AttributeError: 'module' object has no attribute 'python_2_unicode_compatible'
This is likely because your OS X is referencing an older version of six, that is not in your pip installed directory.
Pip installs in /Library/[..] while your system python installs in /System/Library/[..]
If you pip install six, it probably installs 1.9.0, but when you go into your python console, and type
>>> import six
>>> six.__version__
'1.4.1'
You'll probably get the above.
There's two options...the first and easiest is to just implement a virtualenv.
The second is to go to /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python and
$ rm six.py six.pyc
This will then force your console to reference your pip directory as opposed to your python dir, and the proper version will be referenced.
Hope that makes sense.
The pycrunchbase module has dependencies on the six and requests modules.
To get pycrunchbase working:
pip install requests six
And then you should be all set!

Categories