Unresolved reference for some library classes of Cerberus in PyCharm - python

I started running into an import issue where PyCharm is unable to resolve references to classes for some libraries I have installed. I haven't run into this issue for any standard libraries.
from cerberus import Validator used to work but stopped working along with the other reference issues.
I have tried:
File > Invalidate Caches / Restart
Using a difference Anaconda env
Re-installing library

Related

VSCode doesn't recognize ConfluentKafkaLibrary to use in Robot Framework

I need to do a test automation in Robot Framework using Kafka topics. I'm trying to use the ConfluentKafkaLibrary library, but VSCode doesn't recognize it.
I already installed the commands:
pip install robotframework-confluentkafkalibrary
pip install confluent-kafka
Still, it keeps giving the error:
Unresolved library: ConfluentKafkaLibrary. Error generating libspec: Importing library 'ConfluentKafkaLibrary' failed: ModuleNotFoundError: No module named '_bz2' Consider adding the needed paths to the "robot.pythonpath" setting and calling the "Robot Framework: Clear caches and restart" action.
Does anyone know how to solve this problem?
IMAGE - error message
I already tried to reinstall all libraries.
I already tried to configure the robot.pythonpath.
I've restarted VSCode several times, after each step.

No module named 'tensorflow' with GCP

When trying to execute a gcloud ai-platform local train command with python 3.7 files, I get an error like:
No module named 'tensorflow'
This can happen also with numpy, even though both of these libraries are correctly installed. Is there a different installation path for libraries in Google Cloud? I am actually a newbie with GCP and I have no idea of what may be causing this problem. I am working on a Mac and Google SDK is, I guess, correctly installed.
Thanks
error
Naming conventions of packages and modules are expected to be lowercase.
import tensorflow as tf
I suspect the same issue arises with numpy - where you are incorrectly writing import TensorFlow or import Numpy
There is an environment variable named CLOUDSDK_PYTHON that must be set to "python3.x".
My error was caused by GCP using python2, and so not recognizing certain packages.

How to resolve "ImportWarning: can't resolve package from __spec__ ..." in Eclipse PyDev for ema_workbench?

I installed the ema workbench with
pip install ema_workbench
and would like to import some module:
from ema_workbench import Model
If I run this in Jupyter notebook or Spyder, it works fine. If I try to run this in Eclipse PyDev 7.1.0.201902031515 , I get following warning:
D:\EclipsePython\App\WinPython\python-3.7.1.amd64\lib\importlib\_bootstrap.py:219: ImportWarning: can't resolve package from __spec__ or __package__, falling back on __name__ and __path__
return f(*args, **kwds)
I thought that my PyDev settings for the Python Interpreter might be wrong. However, the ema_workbench is listed as installed package and the settings seem to be fine ?!
=>How can I fix that annoying warning?
=>Is this a PyDev issue or an issue of the ema_workbench (that is just not shown for Jupyter and Spyder??)
Related questions:
How to suppress ImportWarning in a python unittest script
Unresolved Import Issues with PyDev and Eclipse
edit
I tried to add
-W ignore:ImportWarning
to the "JVM Arguments" of the python run configuration.
I also tried to put following code on the beginning:
import warnings
warnings.filterwarnings('ignore', category=ImportWarning)
Did not work...
Too my knowledge it is an eclipse / pydev issue related to changes in the import system of python. Just google the message and see the many discussions related to it.

IntelliJ cannot find some generated TensorFlow references

I wrote some TensorFlow code in Python. It compiles and runs fine. However, some names cannot be resolved by IntelliJ.
The error displayed when hovering over such an unfound reference is Cannot find reference '...' in 'tensorflow._api.v1.data'; the expanded message starts with Inspection info: This inspection detects names that should resolve but don't..
One example of such an unresolved reference is tf.data.Dataset. When I navigate to tf.data, there is only an __init__.py module in there, that starts with # This file is MACHINE GENERATED!.
There are many such packages, and they are in External Libraries. What is the proper way to fix this issue?
I faced a similar problem with tf.contrib part. I installed the TensorFlow version 1.10.0 with Anaconda. It uses the conda package manager. To install TF
conda install tensorflow==1.10.0
Installing with Conda solved my problem.

errors with import library in Anaconda

I am facing a strange error. I have installed pyrenn module with pip install in conda environment and solved an ANN problem successfully. But when I restarted the kernel in jupyter or spyder, I am not able to even import the module which shows error: module 'pyrenn' has no attribute 'CreateNN'. But it definitely has the module and it worked last time.
what may be the possible problem?
If you look at your screenshot it shows a path ~/ANN study/pyrenn/pyrenn.py. So not only you are creating a conflicting folder name pyrenn you are also creating a conflicting importable file pyrenn.py.
Follow the thumb rule of not naming the folders and your files which conflict with modules that you will uses or are existing.

Categories