Error with Crunchbase API wrapper pycrunchbase - python

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!

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

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??!

Issue with dependencies -- ImportError: cannot import name getfullargspec

I'm trying to use mayavi in python to visualize a pointcloud, and cannot resolve this error. I'm sure it is an easy pip install, but I am unsure of the command. Any help is much appreciated! Thanks!
BTW, I am running Ubuntu 18.04 and have tried installing scipy as mentioned here: Python import error "getfullargspec". I have also ran pip install traitsui. Additionally, I have rebooted my system.
Update:
After further digging, it appears that it may be an issue with Python versions. I was able to get it to run with Python3, but not Python 2.7 (I need it to work with python 2). I have also tried modifying the code within handler.py to getargspec instead of getfullargspec. I was given an error about trait_factory by doing this
Here is the entire printout:
Traceback (most recent call last):
File "mayavi_test.py", line 3, in <module>
from mayavi import mlab
File "/home/user/.local/lib/python2.7/site-packages/mayavi/mlab.py", line 16, in <module>
from mayavi.tools.camera import view, roll, yaw, pitch, move
File "/home/user/.local/lib/python2.7/site-packages/mayavi/tools/camera.py", line 24, in <module>
from .engine_manager import get_engine
File "/home/user/.local/lib/python2.7/site-packages/mayavi/tools/engine_manager.py", line 12, in <module>
from mayavi.preferences.api import preference_manager
File "/home/user/.local/lib/python2.7/site-packages/mayavi/preferences/api.py", line 4, in <module>
from .preference_manager import preference_manager
File "/home/user/.local/lib/python2.7/site-packages/mayavi/preferences/preference_manager.py", line 29, in <module>
from traitsui.api import View, Group, Item
File "/home/user/.local/lib/python2.7/site-packages/traitsui/api.py", line 37, in <module>
from .editors.api import (
File "/home/user/.local/lib/python2.7/site-packages/traitsui/editors/__init__.py", line 26, in <module>
from .api import (
File "/home/user/.local/lib/python2.7/site-packages/traitsui/editors/api.py", line 6, in <module>
from .array_editor import ArrayEditor
File "/home/user/.local/lib/python2.7/site-packages/traitsui/editors/array_editor.py", line 34, in <module>
from ..view import View
File "/home/user/.local/lib/python2.7/site-packages/traitsui/view.py", line 41, in <module>
from .ui import UI
File "/home/user/.local/lib/python2.7/site-packages/traitsui/ui.py", line 51, in <module>
from .handler import Handler, ViewHandler
File "/home/user/.local/lib/python2.7/site-packages/traitsui/handler.py", line 27, in <module>
from inspect import getfullargspec
ImportError: cannot import name getfullargspec
The solution for this problem was to use older packages. Not all of the dependencies such as traitsui are compatible with Python 2.7. Even though an older version of mayavi was installed, the dependencies that are installed automatically are not compatible (they only support Python 3).
Here are the versions that work well together for me:
mayavi==4.6.2
traitsui==6.1.3
traits==5.2.0
numpy==1.17.4
pyface==6.1.2
To install a specific version, just run sudo pip install packageName==#.#.#

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

Can't open html5lib in Python

I just installed html5lib for Python with Windows Command Prompt. The package was installed here:
File "C:\Python27\lib\site-packages\html5lib
However, if I try to import html5lib:
#! /usr/bin/python
import html5lib
I get the following error:
Traceback (most recent call last):
File "C:\Users\workspace\testhtml5\src\test.py", line 2, in <module>
import html5lib
File "C:\Python27\lib\site-packages\html5lib\__init__.py", line 16, in <module>
from .html5parser import HTMLParser, parse, parseFragment
File "C:\Python27\lib\site-packages\html5lib\html5parser.py", line 2, in <module>
from six import with_metaclass
ImportError: No module named six
Any idea on what might be causing the error? Thanks
You're missing the six module. You can download it from here, or better, use pip install six .

Categories