PyTorch autocomplete in PyCharm seems missing a part - pytorch

PyTorch autocomplete in PyCharm seems missing a part, while in VSCode, it works well.
Example:
In VSCode:
PyTorch autocomplete in VSCode
In PyCharm:
PyTorch autocomplete in PyCharm
PyCharm version: 2022.2.4
VSCode version: 1.75.1
PyTorch version: 1.13.1
I wonder if I could get PyCharm work well just like VSCode.

Related

Cannot import torch Error loading ..\caffe2_nvrtc.dll" or one of its dependencies

I am on a Windows 10 64 bit system.
Pytorch for cuda has been working successfully for some time.
Today I tried to upgrade to the latest version of Pytorch (1.13) using
conda install pytorch torchvision torchaudio pytorch-cuda=11.7 -c pytorch -c nvidia
Now I cannot import torch. I get the error:
OSError: [WinError 126] The specified module could not be found. Error loading "C:\Users\alan\anaconda3\lib\site-packages\torch\lib\caffe2_nvrtc.dll" or one of its dependencies.
I have tried both in a Jupyter notebook and in the Spyder IDE.
I have tried completely removing Anaconda and reinstalling afresh and then reinstalling Pytorch with no success.
I do not believe I have any other versions of python installed.
The offending dll (caffe2_nvrtc.dll) does seem to be in the file location specified.
I have found various similar problems reported but they all date back to 2020 or earlier and none of them seemed to have a satisfactory solution.
Can anyone point me in the correct direction
I still do not understand why using conda did not work but I tried again using pip
and that did work
I experienced the same problem as yours today.
It turns out that when I use the anaconda prompt then the problem disappears.
Anaconda prompt could do it
Then I speculated that the only difference between these two scenarios is that when I use the anaconda prompt, I use the base anaconda environment, probably somehow the conda environment in spyder is not activated.
So the solution is to open the spyder in anaconda prompt like this:
Then it works.
This picture will tell you the cause for the problem.
problem...

fbs freeze failed with Python 3.6.4

I have the following problem with fbs and Python: I tried to compile Python code and wanted to create an executable .exe file in windows. The command fbs run works fine, but fbs freeze fails.
Package versions:
Python 3.6.4
PyInstaller: 3.4
PyQt5: 5.9.2
Packages that I import:
import re
from itertools import chain
import os
import pandas
from PyQt5.QtWidgets import *
from fbs_runtime.application_context.PyQt5 import ApplicationContext
The output of fbs freeze --debug you see in the attached image:
I used the pyinstaller command to create the exe. This was possible without fbs. Just pyinstaller with the standard comments pyinstaller "...." --onefile --noconsole.
It worked with Python 3.6.4 and pyinstaller 3.4. Perhaps 3.5 would also work. But I know at least that Python 3.8.0 with the newest pyinstaller (even development version from git) doesn't work. I used PyQt5, but some older version 5.12....
It's a bit intransparent...
Best regards,
Markus
fbs runs perfectly fine with python 3.6.x (I am using 3.6.8, PyQt 5.9.2, PyInstaller 3.4).
The python compiler can sometimes get confused if another error happens earlier in the stack. Generally if fbs freeze errors when fbs run works, that points to a library-include error.
See my answer here to include necessary python library resources in your ./src/freeze/windows/ directory and try freezing again: The 'google-api-python-client' distribution was not found and is required by the application with pyinstaller

Why does PyCharm not realize that tf.keras is installed?

Although tensorflow is installed, Pycharm does not realize that the module tf.keras exists.
Hovering over the keras results in the following text showing up: "Cannot find reference "keras" in '__init__.py'"
Why?
You are using PyCharm version lower than 3.0.
TensorFlow 2.0 is not running on PyCharm versions older than 2019.3 version.
You can find the answer to your question here: Unable to import Keras(from TensorFlow 2.0) in PyCharm

Can not identify the version of imported packages in my Jupyter Notebook

Nothing seems to work when I try to identify the version of an imported package:
What is creating this problem? What can I do about it?
I am using Python 3.7, Anaconda3 (2019) and Windows 10.
If I try it in notebooks.azure.com then everything works just fine:
import tensorflow
tensorflow.__version__
'1.12.2'
You can also try:
!pip show tensorflow
Name: tensorflow
Version: 1.12.2
Summary: TensorFlow is an open source machine learning framework for everyone.
/..../

PyCharm 2017.1, No module named 'kivy'

I could use (troubleshooting)help with getting Kivy imported in PyCharm. I am using:
Anaconda with Python 3 on 64-bit Windows 10 Pro
PyCharm 2017.1
Packages: NumPy, SciPy, BeautifulSoup, Pandas, Scrapy, Pattern, NetworkX, NLTK, scikit-learn, Selenium
I have installed Kivy following the instructions at https://kivy.org/docs/installation/installation-windows.html#installation
As evident from the screen shot, no errors occurred.
Still, when I run "import kivy" from PyCharm I get "ModuleNotFoundError: No module named 'kivy'".
I ran through the installation with someone on the #kivy channel and was assured that kivy is successfully installed.
When I pass import kivy; print(kivy.file) to the interpreter (opened from the CMD command line), I get returned among others:
C:\Users\Steve\Anaconda3\lib\site-packages\kivy\__init__.py
Someone on #kivy suggested I check where PyCharm looks for kivy. How do I figure that out?
I'd appreciate any suggestions to identify the problem / resolve my issue.
Indeed, the installation of Kivy went fine. The problem turned out to be that I had to select the correct (updated) interpreter in the PyCharm settings.

Resources