Closed JonasKs closed 3 years ago
@JonasKs Thank you for creating this issue. I have tried to reproduce the problem. But, It works fine in my environment.
I will try it in Ubuntu.
I talked to multiple in the FastAPI discord who said it worked perfectly fine for them as well, so I'm not sure what to do.
I tried disabling all plugins except this one, in case there was some interfering plugins causing the issue, but same issue.
Let me know if there is some logs or something I can test for you.
Tried on Ubuntu 20.04.2 with Pycharm: 2021.1
@JonasKs
Let me know if there is some logs or something I can test for you.
Unfortunately, We can get the log :(
OS: Red Hat Enterprise Linux release 8.3 (Ootpa)
Did you enable SE Linux? 🤔
The plugin doesn't touch the suggestion.
@ArcLightSlavik Thank you for posting the screenshot 😄
OS: Red Hat Enterprise Linux release 8.3 (Ootpa)
Did you enable SE Linux? thinking
The plugin doesn't touch the suggestion.
SELinux is enabled, yes. Should that matter? :thinking:
Would you please disable SELinux to test?
PyCharm generates a type-stub file from pydantic*.so. The file doesn't have type information. So, The plugin deletes the files when it is created. I guess SELinux may block the behavior. I haven't got confirmation of that yet.
But, I don't have another idea.
I will test first thing tomorrow morning. I'm unfortunately out for the day.
Thank you for the quick follow up!
Sorry, never got the chance to do this. I’ll try tomorrow.
SELinux disabled:
➜ ~ sestatus
SELinux status: disabled
Unfortunately, the same result:
EDIT: Just tested again, import suggestions are working properly when I disable the plugin again. There's no doubt there is something with my setup, but I'm not sure what. It works for my colleagues (They're not on RHEL/Linux)
@JonasKs Thank you for trying it with disabling SELinux.
This weekend, I installed Ubuntu 20.04 and PyCharm. The plugin works fine :thinking:
Just tested again, import suggestions are working properly when I disable the plugin again.
Did you open the same project?
PyCharm generates a type-stub file from pydantic*.so. The file doesn't have type information. So, The plugin deletes the files when it is created.
I can think of only the part. If the plugin affects the problem.
Are other functions and classes suggested? (exp: BaseModel
, validator
)
(They're not on RHEL/Linux)
Did you know other differences to other distribution? But, PyCharm run on JVM. I guess the differences may not relate to this problem.
Did you open the same project?
No, this time it was a personal project.
I'll try a fresh project with nothing but pydantic installed tomorrow - with and without a virtual environment.
I can think of only the part. If the plugin affects the problem.
Are other functions and classes suggested? (exp:
BaseModel
,validator
)
I don't think so, I'll confirm tomorrow.
Did you know other differences to other distribution?
But, PyCharm run on JVM. I guess the differences may not relate to this problem.
I'm using bundled Java. They are on Windows and on Mac, using same version of the plugin and Pycharm. So, it seems to work for everyone but me.
Don't know what more information I could add about my environment except that I'm using Wayland and Swaywm. Installed using toolbox.
I could try to do a manual install of the 2020.x version?
@JonasKs
Don't know what more information I could add about my environment except that I'm using Wayland and Swaywm. Installed using toolbox.
I always install IDEs using a toolbox.
I could try to do a manual install of the 2020.x version?
I think we don't need to install it manually. But, we may get some hints with the way.
Also, I tried Wayland on Ubuntu. It works fine.
I copied the information from the help menu.
PyCharm 2021.1.1 (Professional Edition)
Build #PY-211.7142.13, built on April 21, 2021
...
Runtime version: 11.0.10+9-b1341.41 amd64
VM: Dynamic Code Evolution 64-Bit Server VM by JetBrains s.r.o.
Linux 5.4.0-72-generic
GC: G1 Young Generation, G1 Old Generation
Memory: 1978M
Cores: 8
Non-Bundled Plugins: CMD Support (1.0.5), Key Promoter X (2021.1.1), PsiViewer (211.6305.21-EAP-SNAPSHOT), com.alayouni.ansiHighlight (1.2.4), com.intellij.ideolog (203.0.27.0), com.intellij.plugins.macoskeymap (211.6432.7), com.jetbrains.ChooseRuntime (1.2), de.netnexus.camelcaseplugin (3.0.8), me.lensvol.blackconnect (0.4.4), net.seesharpsoft.intellij.plugins.csv (2.16.3), org.intellij.plugins.hcl (0.7.10), org.jetbrains.plugins.hocon (2020.1.0), Gitflow (0.7.6), mobi.hsz.idea.gitignore (4.1.0), name.kropp.intellij.makefile (211.6693.108), AWSCloudFormation (211.6693.108), org.toml.lang (0.2.146.3826-211), com.intellij.plugins.html.instantEditing (211.6693.111), org.jetbrains.plugins.vue (211.7142.13), lermitage.intellij.extra.icons (1.51.0.201), com.intellij.swagger (211.7142.14), izhangzhihao.rainbow.brackets (6.17), PlantUML integration (5.3.0), com.koxudaxi.poetry (1.1.3), com.koxudaxi.pydantic (0.3.1), rocks.strawberry (0.0.7), aws.toolkit (1.26-211), ru.adelf.idea.dotenv (2021.1), ru.meanmail.plugin.requirements (2021.3-211)
Current Desktop: ubuntu:GNOME
Other plugins may affect the problem :thinking: Would you please disable other plugins for testing it?
Other plugins may affect the problem thinking Would you please disable other plugins for testing it?
Disabled every single plugin, even the bundled ones, only having tihs plugin enabled. Imports are still broken. Disabling this plugin fixes it again.
I copied the information from the help menu.
Unfortunately there is some issues with these things on Swaywm it seems (popups in general with this window manager..), so it won't open for me, sorry.
Reading through these errors, it seems like I need two modules installed hypothesis
and mypy
, so I installed them in my venv.
Log output is now:
EDIT: Unfortunately, I'm still not able to use auto imports even when thought the previous mentioned errors are gone.
Just to clarify: I'm unable to import any third party module when the plugin is activated.
EDIT2: Logs after invalidating cache and restarting PyCharm:
Sorry for another post, but GitHub won't let me append more to the previous one.
I deleted the ~/.cache/JetBrains/PyCharm2021.1/python_stubs/
folder, invalidated cache and restarted. These are the logs:
The entire package not found errors made me rethink virtualenvs. My virtualenv was installed through pyenv
.
I disabled the virtual environment in PyCharm, and everything worked as it should.
I then compiled and installed Python3.9.5 from source instead of through pyenv
.
I installed poetry to that Python version: python3.9 -m pip install poetry
. Went into my folder and did a poetry install
. Enabling this virtualenv made the imports not work again.
I deleted that .venv and created one through PyCharm instead. Activated that virtualenv and wrote poetry install
. Invalidated caches for the 100th time today. Everything works.
So: Create virtualenv through PyCharm, not through Poetry did the trick for me.
Thanks for listening to my TED talk, and for the awesome plugin :heart:
EDIT: Closed the issue with the intention of opening one at JetBrains. I assume this bug isn't in your package. If these findings make you think otherwise, feel free to re-open :blush:
@JonasKs Thank you for posting the details of the problem. I'm happy your problem was resolved :tada:
I installed poetry to that Python version: python3.9 -m pip install poetry.
Great. I usually installed poetry via pipx
https://python-poetry.org/docs/#installing-with-pipx
pipx
can keep global command without complex settings.
So: Create virtualenv through PyCharm, not through Poetry did the trick for me.
Have you tried my pycharm poetry plugin? https://github.com/koxudaxi/poetry-pycharm-plugin
The plugin integrates poetry environment to PyCharm. It's not hacking. PyCharm provides an official API. The plugin works fine the same as bundled Pipenv integration.
Also, You are sponsoring me!! 😆 Thank you very much
I'll check out both pipx and your poetry plugin, thank you!!
Also, You are sponsoring me!!
I listened to episode 313 of talkpython.fm. Creator of pydantic gave you some nice words and in the end of the episode he encourages not only sponsoring the huge packages, but also those who make those packages awesome. This is one of them. 😊 So my pleasure.
I listened to episode 313 of talkpython.fm.
I listened to it too. :headphones: I agree with his opinion. A lot of people join the community, And it's growing up. the issue, PR, sponsoring, discussion, and other all action are worth for projects. Also, I feel that is awesome things. :smile:
Agree 😊 Have a good Sunday! Thanks again.
Same to you :smile_cat:
Describe the bug Having the
pydantic-pycharm-plugin
enabled breaks autoimports.To Reproduce Steps to reproduce the behavior:
main.py
with the content:Field
and()
.ctrl
+space
+space
oralt
+enter
Expected behavior Autoimports should work.
Environments (please complete the following information):
2021.1
(Edit: Tested in201.1.1
as well. Same issue)1.8.1
0.3.0
Additional context I've tried recreating the environment, clearing and invalidating cache.