Cannot import numpy in pypy3 (installs fine with pip) - python

Been trying to install numpy on pypy3 with pip. The install works fine, but when I do import numpy, I get the following error. Anyone have any advice?
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/carl/pypy3-v6.0.0-linux64/site-packages/numpy/__init__.py", line 142, in <module>
from . import core
File "/home/carl/pypy3-v6.0.0-linux64/site-packages/numpy/core/__init__.py", line 16, in <module>
from . import multiarray
File "/home/carl/pypy3-v6.0.0-linux64/site-packages/numpy/core/multiarray.py", line 44, in <module>
arange.__module__ = 'numpy'
AttributeError: readonly attribute '__module__'
Using the latest pypy3 versions from the site on Ubuntu
Python 3.5.3 (fdd60ed87e94, Apr 24 2018, 06:10:04)
[PyPy 6.0.0 with GCC 6.2.0 20160901] on linux
Latest pip too
pip 18.1 from /home/carl/pypy3-v6.0.0-linux64/site-packages/pip (python 3.5)

numpy 1.16.0 is incompatible with pypy3 v6.0, more details here. The solution is to use either numpy 1.15.4, or to use a pypy3 nightly while waiting for the next release.

Related

Jupyter Labs ModuleNotFoundError: No module named 'traitlets.utils.descriptions'

I would like to install jupyter labs on my linux system. I have python3.9 installed so I run pip install jupyterlab as per official documentation.
After the download is finnished, I get the following error:
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
notebook 6.3.0 requires nbconvert==6.0.7, but you have nbconvert 6.5.0 which is incompatible.
notebook 6.3.0 requires nbformat==5.1.3, but you have nbformat 5.4.0 which is incompatible.
notebook 6.3.0 requires traitlets==4.3.3, but you have traitlets 5.3.0 which is incompatible.
Weird, but I have tried intalling all of these manually afterwards using pip install nbformat==5.1.3 and so on...
After the installation, I run jupyter lab, and the following error appers:
Traceback (most recent call last):
File "/root/venv/bin/jupyter-lab", line 5, in <module>
from jupyterlab.labapp import main
File "/root/venv/lib/python3.9/site-packages/jupyterlab/labapp.py", line 13, in <module>
from jupyter_server.serverapp import flags
File "/root/venv/lib/python3.9/site-packages/jupyter_server/serverapp.py", line 105, in <module>
from jupyter_server.gateway.managers import (
File "/root/venv/lib/python3.9/site-packages/jupyter_server/gateway/managers.py", line 25, in <module>
from ..services.sessions.sessionmanager import SessionManager
File "/root/venv/lib/python3.9/site-packages/jupyter_server/services/sessions/sessionmanager.py", line 20, in <module>
from jupyter_server.traittypes import InstanceFromClasses
File "/root/venv/lib/python3.9/site-packages/jupyter_server/traittypes.py", line 5, in <module>
from traitlets.utils.descriptions import describe
ModuleNotFoundError: No module named 'traitlets.utils.descriptions'
I have tried installing traitlets, but indeed when I run:
import traitlets
traitlets.utils.descriptions
I get:
AttributeError: module 'traitlets.utils' has no attribute 'descriptions'
Maybe this is the wrong version of the module? Which one should I install then?

Error importing tensorflow in Python 3 on Ubuntu 16.04 SyntaxError: l.append("%s=%s" % (attr, `value`))

I have python 3.5 installed on my Linux Mint (Ubuntu 16.04 Xenial)
I also had installed protobuf installed using pip3 install protobuf
I installed tensorflow using pip3 install tensorflow
Then I tried to import tensorflow in python 3 it failed with error presented below:
Traceback (most recent call last):
File "/home/abdullah/face_recognition/tensorflow_test.py", line 1, in <module>
import tensorflow
File "/usr/local/lib/python3.5/dist-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/__init__.py", line 83, in <module>
from tensorflow.python.estimator import estimator_lib as estimator
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/estimator/estimator_lib.py", line 35, in <module>
from tensorflow.python.estimator.inputs import inputs
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/estimator/inputs/inputs.py", line 22, in <module>
from tensorflow.python.estimator.inputs.numpy_io import numpy_input_fn
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/estimator/inputs/numpy_io.py", line 22, in <module>
from tensorflow.python.estimator.inputs.queues import feeding_functions
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/estimator/inputs/queues/feeding_functions.py", line 40, in <module>
import pandas as pd
File "/usr/local/lib/python3.5/dist-packages/pandas/__init__.py", line 23, in <module>
from pandas.compat.numpy import *
File "/usr/local/lib/python3.5/dist-packages/pandas/compat/__init__.py", line 361, in <module>
from dateutil import parser as _date_parser
File "/usr/local/lib/python3.5/dist-packages/dateutil/parser.py", line 158
l.append("%s=%s" % (attr, `value`))
^
SyntaxError: invalid syntax
Consulting through many questions posted on SO and other forums, I tried uninstalling protobuf then I encountered following error.
Traceback (most recent call last):
File "/home/abdullah/face_recognition/tensorflow_test.py", line 1, in <module>
import tensorflow
File "/usr/local/lib/python3.5/dist-packages/tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/__init__.py", line 52, in <module>
from tensorflow.core.framework.graph_pb2 import *
File "/usr/local/lib/python3.5/dist-packages/tensorflow/core/framework/graph_pb2.py", line 6, in <module>
from google.protobuf import descriptor as _descriptor
ImportError: No module named 'google.protobuf'
At the moment I'm just a beginner for all of this. I don't why protobuf is required why do all this hassle? I just wanted to get tensorflow installed on my system and try to learn something.
I was also facing the same problem. The problem I think is this is using pandas from system(apt-get) repository which is not compatible with other libraries. Updating pandas do the trick.
pip3 install --upgrade pandas
Also in your case, if only doing above fails, you can also try to reinstall tensorflow and protobuf with upgrade option.
pip3 install --upgrade protobuf
pip3 install --upgrade tensorflow
I just installed TensorFlow on my system today (Ubuntu 16.04 LTS) using VirtualEnv.
Did you run$ sudo apt-get install python3-pip python3-dev
If so, then try $ pip3 install -upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.4.0-cp35-cp35m-linux_x86_64.whl
Worst comes to worse, you could simply uninstall TensorFlow using $ sudo pip3 uninstall tensorflow and then try reinstalling to see if it corrects any errors.

Tensorflow on OSX: Failed to load the native TensorFlow runtime (No module named pywrap_tensorflow_internal)

I'm trying to install Tensorflow (r1.2) on my MacBook (OSX 10.12.5).
The installation works, but I'm getting errors, when I try to import TF in python.
Python 2.7.10 (default, Feb 7 2017, 00:08:15)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
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 "tensorflow/__init__.py", line 24, in <module>
from tensorflow.python import *
File "tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "tensorflow/python/pywrap_tensorflow.py", line 52, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
ImportError: No module named pywrap_tensorflow_internal
Failed to load the native TensorFlow runtime.
I'm working in a virtualenv (using virtualenvwrapper) with up-tp-date packages
python 2.7.10
pip 9.0.1
numpy 1.13.1
wheel 0.29.0
six 1.10.0
I tried to install the default pip package (no GPU support) using pip install tensorflow, first.
Afterwards I also tried to install tensorflow from source following the installation tutorial, without CUDA support (configure script said No CUDA support will be enabled for TensorFlow). Building and installing reported no errors, but I got the same error when I tried to import tensorflow.
Related questions/answers pointed out problems with CUDA or missing Windows dll files, which do not seem to fit my problem.
Any help is welcome. Thanks in advance.
I have the same problem.i did this
First
pip uninstall tensorflow
Download this tensorflow wheel file
Now install this using(in same Directory)
pip install tensorflow-1.6.0-cp36-cp36m-win_amd64.whl
My answer is same to yours.
I deleted the tensorflow with "rm -r ~/tensorflow ",
and finally it working when I have reinstalled it
The detail is here:https://www.tensorflow.org/install/install_mac#CommonInstallationProblems

Tensorflow pip built from source fails on 'import tensorflow'

Built tensorflow 0.7 from source on Ubuntu 15.10, Cuda 7.5, cudnn 4.0, python 2.7. Bazel build and pip package generation OK. pip install ok. Python script "import tensorflow" fails:
Traceback (most recent call last):
File "/home/keith/Desktop/tf1.py", line 8, in <module>
import tensorflow as tf
File "/usr/local/lib/python2.7/dist-packages/tensorflow/__init__.py", line 23, in <module>
from tensorflow.python import *
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/__init__.py", line 35, in <module>
from tensorflow.core.framework.graph_pb2 import *
File "/usr/local/lib/python2.7/dist-packages/tensorflow/core/framework/graph_pb2.py", line 16, in <module>
from tensorflow.core.framework import attr_value_pb2 as tensorflow_dot_core_dot_framework_dot_attr__value__pb2
File "/usr/local/lib/python2.7/dist-packages/tensorflow/core/framework/attr_value_pb2.py", line 16, in <module>
from tensorflow.core.framework import tensor_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__pb2
File "/usr/local/lib/python2.7/dist-packages/tensorflow/core/framework/tensor_pb2.py", line 16, in <module>
from tensorflow.core.framework import tensor_shape_pb2 as tensorflow_dot_core_dot_framework_dot_tensor__shape__pb2
File "/usr/local/lib/python2.7/dist-packages/tensorflow/core/framework/tensor_shape_pb2.py", line 22, in <module>
serialized_pb=_b('\n,tensorflow/core/framework/tensor_shape.proto\x12\ntensorflow\"z\n\x10TensorShapeProto\x12-\n\x03\x64im\x18\x02 \x03(\x0b\x32 .tensorflow.TensorShapeProto.Dim\x12\x14\n\x0cunknown_rank\x18\x03 \x01(\x08\x1a!\n\x03\x44im\x12\x0c\n\x04size\x18\x01 \x01(\x03\x12\x0c\n\x04name\x18\x02 \x01(\tB/\n\x18org.tensorflow.frameworkB\x11TensorShapeProtosP\x01\x62\x06proto3')
TypeError: __init__() got an unexpected keyword argument 'syntax'
Any thoughts?
Thanks
This does look like a protobuf library versioning error. There's a long thread on similar issues here:
https://github.com/tensorflow/tensorflow/issues/11
Towards the end there are some suggested solutions that might help.
I succeed in running TensorFlow 0.7 on a manjaro linux laptop using cuda acceleration by running python with optirun:
$optirun python
However, I had problem with protobuf and I had to uninstall/reinstall previous version of protobuf and tensorflow with pip. http://bit.ly/1RHApU5
This is because of protobuf version conflict:
for me i had python-protobuf v2.6.1 installed from apt-get package manager
and while installing tensorflow it installed protobuf v3.3.0 from pip manager
so i uninstalled both:
sudo pip uninstall protobuf
sudo apt-get remove python-protobuf
Reinstalled using pip and it solved the issue!!!
sudo pip install protobuf
Hope this helps..

Unable to import ssl on linux

When I try to import ssl on any Python version I get
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/ssl.py", line 98, in <module>
import _ssl # if we can't import it, let the error propagate
ImportError: /lib/x86_64-linux-gnu/libssl.so.1.0.0: symbol X509_chain_up_ref, version
OPENSSL_1.0.2 not defined in file libcrypto.so.1.0.0 with link time reference
I have compiled Python 3.5 myself with libssl-dev version 1.0.2. According to aptitude I have libssl1.0.0.0 version 1.0.2 and openssl version 1.0.2 installed.
It seems to be a problem with the different version of libssl, openssl and libssl-dev but I have installed an reinstalled the newest version of all of them via the Package manager.
Im using Ubuntu 15.10 64-bit

Categories

Resources