Failure to import sknn.mlp / Theano - python

I'm trying to use scikit-learn's neural network module in iPython... running Python 3.5 on a Win10, 64-bit machine.
When I try to import from sknn.mlp import Classifier, Layer , I get back the following AttributeError: module 'theano' has no attribute 'gof' ...
The command line highlighted for the error is class DisconnectedType(theano.gof.type.Type), within theano\gradient.py
Theano version is 0.8.2, everything installed via pip.
Any lights on what may be causing this and how to fix it?

Apparently it was caused by some issue with Visual Studio. The import worked when I reinstalled VS and restarted the computer.
Thanks #super_cr7 for the prompt reply!

Related

Why do I need to import tensorflow before import spaCy?

I am using python 3.8, spaCy 3.2.4, tensorflow 2.8.0, cuda 11.2, tensorflow-gpu 2.8.0. I want to import spacy, but it shows this error
import spacy
Process finished with exit code -1073740791 (0xC0000409)
Then, to fix this issue, I have to use this code
import tensorflow
import spacy
Now, it works. Although I already fixed the issue, I still want to know the reason behind the solution.
Furthermore, another question is when typing
import spacy
It shows:
Backend QtAgg is interactive backend. Turning interactive mode on.
How to always choose Qt5Agg or TkAgg instead of QtAgg? How to always turn on the interactive mode? I am using PyCharm IDE Community Edition 2020.3.5.

Cannot import cv2 library with OpenVino

I'm trying to do inference with OpenVino Model Optimizer as detailed here.
The code I have so far runs without installing cv2, but I can't get any further because trying to import cv2 consistently throws an error. The code is:
import openvino
from openvino.inference_engine import IECore, IENetwork
import cv2
ie = IECore()
net = ie.read_network(model='saved_model.xml', weights='saved_model.bin')
This runs without
import cv2
However, anytime the cv2 import is included the following error is thrown:
File "/opt/intel/openvino_2021/python/python3.9/cv2/__init__.py", line 129, in <module>
bootstrap()
File "/opt/intel/openvino_2021/python/python3.9/cv2/__init__.py", line 112, in bootstrap
import cv2
ImportError: dlopen(/opt/intel/openvino_2021.4.752/python/python3.9/cv2/python-3/cv2.so, 2): Symbol not found: _objc_alloc_init
Referenced from: /opt/intel/openvino_2021.4.752/python/python3.9/cv2/python-3/../../../../opencv/lib/libopencv_videoio.4.5.dylib (which was built for Mac OS X 10.15)
Expected in: /usr/lib/libobjc.A.dylib
in /opt/intel/openvino_2021.4.752/python/python3.9/cv2/python-3/../../../../opencv/lib/libopencv_videoio.4.5.dylib
I've tried downgrading cv2 to various previous versions but this did not seem to help. cv2 is needed for the cv2.dnn.blobFromImage method which I'm trying to use in this script.
Has anyone seen this problem before? Not sure how to interpret this error message.
Refer to Install and Configure Intel® Distribution of OpenVINO™ toolkit for macOS, the Intel® Distribution of OpenVINO™ version 2021.4.2 is supported on macOS version 10.15 and Python version 3.6 – 3.8.
Please ensure your Operating System is macOS 10.15 and Python version within 3.6 to 3.8.

I am doing docker Jupyter deep learning course and ran in to a problem with importing keras libraries and packages

I tried running this command but i get erros that i dont have tenserflow 2.2 or higher. But I checked and I have the correct version of tenserflow. I also did pip3 install keras command
I know for a fact that all of the code is correct because it worked for my teacher the other day and nothing has changed. I just need to run his commands but i keep running into problems
I am doing this course following everything he does in a recorded video so there must be no issue there but for some reason it just doesn't work
just install tensorflow as requested in the last line of the error message: pip install tensorflow. It is needed as backend for Keras.
Also, since keras is part of tensorflow now, I recommend to write imports as from tensorflow.keras.[submodule name] import instead of from keras.[submodule name] import

Import Error of TensorFlow in Visual Studio Code

I work on the python code in VS Code for image processing and i need to use tensorflow. When I want to import tensorflow i get this error:
import tensorflow as tf
E0401:Unable to import 'tensorflow'
I have read ImportError: No module named tensorflow for Visual Studio Code but it is used for working with GPU but I only want to work with CPU.
How can I fix it?
Thanks in advance.
You should create an environment for your python project.
After that, you should install tensorflow with pip.

example_parser_configuration_pb2 import issue for tensorflow

Using Python 2.7 (miniconda) and trying to run below example, but it is said Unresolved reference to example_parser_configuration_pb2, does anyone have any solutions?
BTW, my machine is configured with tensorflow and I can run some tensorflow examples, so tensorflow basic configuration should be ok.
from tensorflow.core.example import example_parser_configuration_pb2
https://github.com/tensorflow/tensorflow/blob/754048a0453a04a761e112ae5d99c149eb9910dd/tensorflow/python/util/example_parser_configuration_test.py#L70
regards,
Lin

Categories

Resources