TensorFlow error: funcsigs module doesn't have signature attribute - python

I have installed TensorFlow and wanted to check the installation. Here is the interaction with the python console.
Python 2.7.5 (default, Nov 20 2015, 02:00:19)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/shehab1/.local/lib/python2.7/site-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/home/shehab1/.local/lib/python2.7/site-packages/tensorflow/python/__init__.py", line 106, in <module>
from tensorflow.python.platform import test
File "/home/shehab1/.local/lib/python2.7/site-packages/tensorflow/python/platform/test.py", line 81, in <module>
import mock # pylint: disable=g-import-not-at-top,unused-import
File "/home/shehab1/.local/lib/python2.7/site-packages/mock/__init__.py", line 2, in <module>
import mock.mock as _mock
File "/home/shehab1/.local/lib/python2.7/site-packages/mock/mock.py", line 81, in <module>
inspectsignature = funcsigs.signature
AttributeError: 'module' object has no attribute 'signature'
>>>
Could anyone please tell what I am doing wrong? Thanks.

As Yaroslav noted, this is most likely from running too old a version of Python, or you don't have the funcsigs package installed. For the latter, try pip install funcsigs

Related

import ldap3 error File "<stdin>", line 1, in <module> File "/usr/local/lib/python3.9/dist-packages/ldap3/__init__.py", line 255, in <module>

I have installed ldap3 module for my python3. When I try to run import ldap3, I get such error. Can someone please advice me what to do?
python3
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ldap3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.9/dist-packages/ldap3/__init__.py", line 255, in <module>
from .core.connection import Connection
File "/usr/local/lib/python3.9/dist-packages/ldap3/core/connection.py", line 53
from ..strategy.async import AsyncStrategy
^
SyntaxError: invalid syntax
>>>

Python: importing from somewhere else?

bash-4.1$ airflow initdb
Traceback (most recent call last):
File "/u/bin/airflow", line 4, in <module>
from airflow import configuration
File "/u/lib/python2.7/site-packages/airflow/__init__.py", line 31, in <module>
from airflow.models import DAG
File "/u/lib/python2.7/site-packages/airflow/models.py", line 53, in <module>
from croniter import croniter
File "/u/lib/python2.7/site-packages/croniter/__init__.py", line 3, in <module>
from .croniter import croniter
File "/u/lib/python2.7/site-packages/croniter/croniter.py", line 8, in <module>
from dateutil.relativedelta import relativedelta
File "build/bdist.linux-x86_64/egg/dateutil/relativedelta.py", line 5, in <module>
ImportError: cannot import name integer_types
But no issues in interpreter:
bash-4.1$ /u/bin/python2.7
Python 2.7.5 (default, Oct 17 2013, 14:04:34)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import croniter
>>>
I am assuming it has to do something with:
File "build/bdist.linux-x86_64/egg/dateutil/relativedelta.py", line 5, in <module>
So in interpreter it Is using dateutil from /u/lib/python2.7 whereas in airflow it's using datutil from build/bdist.linux-x86_64/egg/dateutil??
I don't even know where build/bdist.linux-x86_64/egg/dateutil is.
Can someone tell me what's going on and how to tell airflow to import from correct dateutil?
You need to install Six python package.
Just make a pip install six

Cannot import PYMC

When I try to import PYMC installed with pip, enpgk or the canopy GUI package manager, I tried all of them and without success.
Enthought Canopy Python 2.7.9 | 64-bit | (default, Jun 30 2015, 22:40:22)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-55)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymc
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/renanpc/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pymc/__init__.py", line 30, in <module>
from .CommonDeterministics import *
File "/home/renanpc/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pymc/CommonDeterministics.py", line 21, in <module>
from .utils import safe_len, stukel_logit, stukel_invlogit, logit, invlogit, value, find_element
File "/home/renanpc/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pymc/utils.py", line 14, in <module>
from . import flib
ImportError: libgfortran.so.1: cannot open shared object file: No such file or directory
I tried to install GFORTRAN with :
~$ sudo apt-get install gfortran-4.6
but I still get the same error.
(there are other questions very similar indeed, but usually the answer has to do with Anaconda and I'm using Canopy)
Any idea of what is going on ? I can import other packages.

Occasional error of import matplotlib

In a newly created terminal, I can import matplotlib with no error. After working for some time in the terminal, however, the following happens:
Python 2.7.5 (default, Mar 9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
Usage: example.py torrentfile.torrent
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/__init__.py", line 134, in <module>
from matplotlib.rcsetup import (defaultParams,
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/rcsetup.py", line 19, in <module>
from matplotlib.colors import is_color_like
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/colors.py", line 54, in <module>
import matplotlib.cbook as cbook
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/matplotlib/cbook.py", line 15, in <module>
import new
File "new.py", line 12, in <module>
with open(sys.argv[1], 'rb') as fh:
IndexError: list index out of range
What's wrong?
With the help of #CaptainMurphy and #IronManMark20, I discovered new.py and new.pyc under ~/temp, which shadows some matplotlib files. After removing them, the problem is solved.

ImportError with pythons libghmm library

I have followed the installation directions to install the GHMM library. However, I still get the following error:
Python 2.6.6 (Apr 11 2011, 15:50:32)
[GCC 4.4.4 20100726 (Red Hat 4.4.4-13)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ghmm
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "ghmm.py", line 112, in <module>
import ghmmwrapper
File "ghmmwrapper.py", line 25, in <module>
_ghmmwrapper = swig_import_helper()
File "ghmmwrapper.py", line 17, in swig_import_helper
import _ghmmwrapper
ImportError: libghmm.so.1: cannot open shared object file: No such file or directory
I tried to change my LD_PRELOAD_PATH variable to /usr/local/lib to no avail.
Also, when I try to locate libghmm, I get the following, so the libraries are definitely there:
% locate libghmm
/usr/local/lib/libghmm.a
/usr/local/lib/libghmm.la
/usr/local/lib/libghmm.so
/usr/local/lib/libghmm.so.1
/usr/local/lib/libghmm.so.1.0.0
Any ideas?

Categories

Resources