IntelliJ cannot find some generated TensorFlow references - python

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.

Related

Pip not recognizing PyTorch with ROCm installation

On the PyTorch website it lists two blocks of commands for the ROCm version installation. The first one, that installs torch itself, goes well, but when I try to import it shows this message.
ImportError: libtinfo.so.5: cannot open shared object file: No such file or directory
Also, when trying to install the torchvision package with the second block of commands, it shows a similar error.
ModuleNotFoundError: No module named 'torch'
This only happens for with the ROCm compute platform. Installing with CUDA works just fine, but unfortunately I don't have a NVidia GPU.
I believe it was a bug that haven't been fixed. You can make a local symbolic link named libtinfo.6.so to /usr/lib/libtinfo5.so, in the same folder as libtaichi_core.so
This should solve it,

ImportError loading spacy in jupyter notebook

I got a problem I can't seem to figure out. The first time I imported Spacy into a Jupyter notebook I had no problems. It just imported it as I expected.
The second time I tried to import it (using a different notebook) I got:
ImportError: cannot import name 'prefer_gpu' from 'thinc.api' (C:\python-environments\nlp\lib\site-packages\thinc\api.py)
So I tried to restart the kernel and tried it again (thinking that might be the issue). That did not solve it. Also trying to run the same cell that imported Spacy in the first notebook also throws the error now after it went well the first time.
It sounds like you have an old version of Thinc somewhere; try uninstalling and reinstalling Thinc.
Another thing to check is if you're running in the right Python environment. Sometimes Jupyter notebooks pull in a different environment than the one you're expecting in non-obvious ways. There was a thread in spaCy discussions about this recently. You can run this command to check which Python executable is being used in the notebook and make sure it's the one you think it is:
import sys
print(sys.executable)
I had a similar issue, followed the git hub link, created a new environment, and installed all required packages, and it resolved my issue. I'm using Visual code, so I had to install other dependencies since VC uses this as a conda environment as a base for my code implementation

XGBoost Package Failing to Load in PyCharm

I currently am trying to use XGBoost in a python project inside of PyCharm and it always will say that it is installed as is shown here, Showing Install,
and it shows confirmation here at the bottom but it is not listed in the package list. Then it is not available for use in my program. Any help with this is appreciated.
Confusion is probably caused by PY-29611 issue - PyCharm reported failed package installations as successful. The problem with PyCharm UI should be fixed in 2018.1.2, meanwhile, try to install XGBoost from the terminal to discover the real problem behind the failed installation.

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.

Importing matplotlib.pyplot fails in PyCharm due to AttributeError: module 'PyQt5.QtGui' has no attribute 'QApplication'

I wanted to change my python compiler to "newer" one (within one project) and use some additional packages with conda. After the installation all my packages worked fine and I could use the console, however matplotlib.pyplot fails to import since then. And throws the following error: app = QtGui.QApplication([" "])
AttributeError: module 'PyQt5.QtGui' has no attribute 'QApplication'
After doing some research on this I found this one: link
It is suggesting to change inputhooks.py (on line 513 and change GUI_QT:enable_qt4 to GUI_QT: enable_qt5 4 to 5)
As it is a company machine, I can't have admin rights to overwrite things within PyCharm.
Can you recommend a better solution to avoid this?
Why is this popping up?
ErrorLogScreenshot
Also I tried to install the newer version of pyqt but that didn't fix the problem.
In the same time
Within pydev the interactiveshell.py fails as well. with the following error message:self.showtraceback(running_compiled_code=True)
TypeError: showtraceback() got an unexpected keyword argument 'running_compiled_code'
I understand it gets an argument which it is not expecting. I did some research on this one as well and some could fix it by deleting a stale a corresponding .pyc file (I couldn't find one at the same location as the initial file only interactiveshell.py)
Below this blog regarding pydev the conversation never went further
https://github.com/ipython/ipython/issues/10687
Is there a way to fix it?
I am kind of new to Python and don't quite understand the heart of it at this depth so any help is appreciated.
Thanks,
Anna
For anyone having the same issue, I have solved this problem by switching to qt and pyqt 4. To do so, follow the following procedure:
conda remove qt
conda install qt=4
conda install -c anaconda pyqt=4.11.4
conda install matplotlib --no-update-dependencies
If you are not using a virtual environment, you might also have to remove anaconda navigator before installing new packages:
conda uninstall anaconda-navigator
At the beginning of your program, switch matplotlib backend:
import matplotlib.pyplot as plt
plt.switch_backend('Qt4Agg')
Inspired by this solution.
After updating PyCharm all issues seem to have been resolved. (I was using versin 2017.1)
The show traceback error was due to pydev, and the new release fixes it.
As well as the GUI problem.
I was able to solve it by finding the file, and both messages disappeared, and matplotlib seems to work fine again.
Under this folder (I named my environment py35):
C:\Users\myusername\AppData\Local\Continuum\anaconda3\envs\py35\Lib\site-packages\IPython\core__pycache__
I found the file: interactiveshell.cpython-35.pyc and deleted it -
(This solves the problem only on Python 3.5)

Categories