Closed luiscoms closed 1 year ago
Same issue is happening with IntelliJ IDEA 2022.2 (Ultimate Edition) as well.
IntelliJ IDEA 2022.2 (Ultimate Edition)
Build #IU-222.3345.118, built on July 26, 2022
Runtime version: 17.0.3+7-b469.32 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 12.3.1
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 12
Metal Rendering is ON
Non-Bundled Plugins:
org.rust.lang (0.4.175.4772-222)
com.intellij.nativeDebug (222.3345.111)
org.jetbrains.plugins.go (222.3345.118)
com.jetbrains.lang.ejs (222.3345.108)
com.intellij.plugins.html.instantEditing (222.3345.108)
Pythonid (222.3345.118)
net.ashald.envfile (3.2.2)
com.leinardi.pycharm.pylint (0.14.0)
org.intellij.scala (2022.2.10)
com.cursiveclojure.cursive (1.12.4-2022.2)
Kotlin: 222-1.7.10-release-334-IJ3345.118
Same here.
PyCharm 2022.2 (Community Edition)
Build #PC-222.3345.131, built on July 27, 2022
Runtime version: 17.0.3+7-b469.32 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 5.8.0-63-generic
GC: G1 Young Generation, G1 Old Generation
Memory: 1994M
Cores: 12
Non-Bundled Plugins:
org.jetbrains.intellij.scripting-javascript (1.0)
org.intellij.plugins.hcl (222.3345.108)
net.seesharpsoft.intellij.plugins.csv (2.19.0)
name.kropp.intellij.makefile (222.3345.108)
com.jetbrains.plugins.ini4idea (222.3345.108)
com.intellij.ideolog (203.0.30.0)
com.4lex4.intellij.solarized (2.4.0)
mobi.hsz.idea.gitignore (4.4.2)
net.ashald.envfile (3.2.2)
com.y4kstudios.pytestimp (0.8.0)
Docker (222.3345.118)
ru.adelf.idea.dotenv (2022.2)
Batch Scripts Support (1.0.13)
Current Desktop: ubuntu:GNOME
Same for me.
PyCharm 2022.2 (Professional Edition)
Build #PY-222.3345.131, built on July 27, 2022
Licensed to Volodymyr Pivoshenko
Subscription is active until October 10, 2022.
Runtime version: 17.0.3+7-b469.32 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 11.6.7
GC: G1 Young Generation, G1 Old Generation
Memory: 3096M
Cores: 12
Metal Rendering is ON
Registry:
debugger.watches.in.variables=false
ide.balloon.shadow.size=0
Non-Bundled Plugins:
uk.co.hadoopathome.intellij.avro.intellijavroviewer (3.0.0)
socrates.tabshifter (0.30)
org.rust.lang (0.4.175.4772-222)
org.jetbrains.action-tracker (0.3.3)
org.intellij.qodana (222.3345.108)
org.ice1000.julia (0.4.2)
net.sf.opk.avro-schema-support (213.1.0)
net.seesharpsoft.intellij.plugins.csv (2.19.0)
name.kropp.intellij.makefile (222.3345.108)
lermitage.intellij.extratci (1.23.0.201)
leetcode-editor (8.2)
jms-messenger (2.0.1)
indent-rainbow.indent-rainbow (2.0.2)
idea.plugin.protoeditor (222.3345.108)
de.docs_as_co.intellij.plugin.diagramsnet (0.1.12)
com.wakatime.intellij.plugin (14.0.6)
com.vecheslav.darculaDarkerTheme (1.2.0)
com.mroche.JsonHelper (1.2.0)
com.markskelton.one-dark-theme (5.6.0)
org.intellij.plugins.hcl (222.3345.108)
com.intellij.plugins.vscodekeymap (222.3345.111)
com.intellij.plugins.macoskeymap (222.3345.108)
com.intellij.javafx (1.0.4)
com.intellij.ideolog (203.0.30.0)
com.intellij.grpc (222.3345.108)
com.intellij.apacheConfig (222.3345.108)
com.github.patou.gitmoji (1.10.0)
com.github.lppedd.idea-conventional-commit (0.21.0)
com.github.balintrudas.avro-random-generator (1.0.2)
com.4lex4.intellij.solarized (2.4.0)
club.nutsoft.Github3Theme (1.1.9)
appland.appmap (0.7.10)
String Manipulation (9.5.0)
Key Promoter X (2022.2)
IdeaVIM (1.10.3)
GrepConsole (12.14.211.6693.0)
zielu.gittoolbox (212.9.7)
mobi.hsz.idea.gitignore (4.4.2)
com.mallowigi (65.1.0)
PlantUML integration (5.16.1)
com.intellij.lang.jsgraphql (3.2.1)
com.intellij.queryComplexity (222.3345.108)
org.asciidoctor.intellij.asciidoc (0.37.33)
com.intellij.swagger (222.3345.108)
ru.meanmail.plugins.prettify-python (2020.2-222-EAP-SNAPSHOT)
ru.meanmail.plugin.requirements (2022.3-222-EAP-SNAPSHOT)
org.jfrog.idea (1.16.0)
net.ashald.envfile (3.2.2)
izhangzhihao.rainbow.brackets (6.25)
com.intellij.bigdatatools (222.3048.12)
com.google.idea.bazel.ijwb (2022.07.25.0.1-api-version-222)
com.github.copilot (1.1.28.1744)
R4Intellij (222.3345.118)
ru.adelf.idea.dotenv (2022.2)
aws.toolkit (1.48-222)
@ashald
Same.
I have a stack trace:
Same error here
Having the same error.
Existing feature request for making this a native feature of the IDE:
https://youtrack.jetbrains.com/issue/IDEA-137820 https://youtrack.jetbrains.com/issue/PY-5543
oof. ... Those feature requests are 11 and 7 years old respectively.
@ashald
Same.
I have a stack trace:
stack trace
This issue is fixed in the master branch of this repo (see https://github.com/ashald/EnvFile/pull/158 ), which has not yet been published. You can install it by building from source and adding the plugin from the generated zip file.
I have tried it and the issue of empty env vars persists, which means it unfortunately is not related to this exception and there is no fix available yet... π
I'm not a user of the EnvFile plugin, but I'm subscribed to updates on PY-5543 and I saw a comment about the recent version incompatibility.
For EnvFile users with simple .env
files, in key=value
format, patch-env might be a good work-around until this plugin gets updated. pip install patch-env
and set PATCH_ENV_COMMAND
in your run config to a command whose output declares all the environment variables you want in your Python process's environment.
PATCH_ENV_COMMAND="cat first.env second.env"
patch-env doesn't do environment variable substitution or support or other input formats, but it will run any command you specify to get its input, so you can be creative with how the variable data gets assembled.
For those wanting to employ then patch_env solution with an env file local to your script/module path, you can use something like this:
PATCH_ENV_COMMAND=cat $(pwd)/.env
@KhanMechAI Use:
grep -Ev '(#|^$)' $env_file_name
to skip comments and empty lines in the env file.
For me, installing Pycharm Professional 2021.3.3 fixed the issue. You can do it here https://www.jetbrains.com/pycharm/download/other.html I am running a Mac with Apple silicon
@larrykooper degrading of your PyCharm version is not the issue fix
@ashald Is this project being maintained? Is there a fix for this issue on the horizon?
@ashald previous time fix took a lot of time. So it's rarely supported
Same here :(
Same issue here
@KhanMechAI Use:
grep -Ev '(#|^$)' $env_file_name
to skip comments and empty lines in the env file.
Here's a bash script which would allow to easily concatenate the contents of multiple .env files. Just save this script and pass the .env file path (relative or absolute) as arguments.
#!/bin/bash
# Documentation here :
# https://gist.github.com/dehidehidehi/6c92f618e4d841e6cc8b2dce8a3b0b7d
# Here's a bash script which would allow to easily concatenate the contents of multiple .env files.
# Just save this script and pass the .env file path (relative or absolute) as arguments.
ENV_VARS_LIST=""
for envFile in $@
do
grep -Ev '(#|^$)' $envFile
done
# Credits:
# The base idea for this script is credited to
# https://github.com/sterwill
# Grep idea is credited to
# https://github.com/mousomer
Examples usage:
patchEnvProvider.sh envfile1.sh envfile2.sh envfile3.sh
Here's the link to the gist in case I update the code. https://gist.github.com/dehidehidehi/6c92f618e4d841e6cc8b2dce8a3b0b7d
Got same issue in PyCharm 2022.2.1 Professional Edition.
Build #PY-222.3739.56, built on August 16, 2022
Runtime version: 17.0.3+7-b469.37 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
It worked before IDE update, but now I get empty env variables in any existing/new run configurations.
Same issue, PyCharm 2022.2.1 Pro. I used to have shell automation for changing environment files and everything would run smoothly. Now I'm flooded with hand updated configuration profiles that constantly get out of date.
@ashald Do you plan to fix this issue or is this project abandoned already?
@ashald are u planning to fix this?
I can't quite figure out why it's broken, but I managed to get the plugin working in pycharm using an experimental internal API. Releases here | Diff | CI for the release
Notes for developers:
Using the EP above means it builds, and works for IDE version 2022.2, but it might break in the future. I pushed the changes to my fork and I'm trying to get it to work for the other IDEs. For those who'd like to debug, the EP used in the idea portion doesn't seem to exist anymore, but the people in the slack assured me it still does π€·. For the other IDEs, they use a separate EP which is still accessible, but for some reason, the patchCommandLine
method is no longer called. I brought up both of these issues in the slack here, but I'm still struggling to get help.
Small update: I managed to find from the Go EP that the patchCommandLine method is actually deprecated, though that isn't marked on the base class that all these EPs inherit from, nor is it marked on the python EP. No alternative is proposed. The most consistent thing about the intellij plugin platform is how terrible an experience it is.
@HassanAbouelela thank you so much for this. Really looking forward to a stable solution.
Follow up: I have some bad news, and some good news. I asked on the slack again, and this time I got confirmation that this is in fact a bug! This most likely means that the plugin will not work in 2022.2 (unless we find other workarounds like the one for pycharm).
The good news is that this is a bug, and hopefully will be fixed or we'll get an alternative. I'll update this issue with a YouTrack issue later.
degrading of your PyCharm version is not the issue fix
@olegchigirin but it provides a very use-able workaround for the time-being though. and its pretty easy to change what version you are using with the toolbox
Youtrack: https://youtrack.jetbrains.com/issue/PY-56172/RunConfigurationpatchCommandLine-Not-Called-In-20222
There's a lot of templates to choose from here, lets hope this was reported correctly, and to have a fix in the next version π .
FWIW, I'm using the following pycharm build:
PyCharm 2022.2.2 (Professional Edition)
Build #PY-222.4167.33, built on September 15, 2022
Runtime version: 17.0.4+7-b469.53 amd64
...
Non-Bundled Plugins:
...
net.ashald.envfile (3.2.4)
...
And this v3.2.4 release of the plugin from @HassanAbouelela appears to work. Many thanks for this stopgap!
FYI @HassanAbouelela 's 3.2.4 appears to work on Python modules with IDEA too, although I do get some noisy errors thrown presumably since the idea implementation is commented out in build.gradle
Caused by: java.lang.ClassNotFoundException: net.ashald.envfile.products.idea.IdeaRunConfigurationExtension PluginClassLoader(plugin=PluginDescriptor(name=EnvFile, id=net.ashald.envfile, descriptorPath=plugin.xml, path=~/.local/share/JetBrains/IntelliJIdea2022.2/EnvFile, version=3.2.4, package=null, isBundled=false), packagePrefix=null, instanceId=363, state=active)
@ashald, is this repo abandoned? Should I use @HassanAbouelela fork instead?
@HassanAbouelela 's 3.2.4 works on PyCharm 20222.2.2, but sadly it breaks Python Console tab : (
java.lang.ClassCastException: class com.jetbrains.python.console.PydevConsoleRunnerImpl$PythonConsoleRunParams cannot be cast to class com.jetbrains.python.run.AbstractPythonRunConfiguration (com.jetbrains.python.console.PydevConsoleRunnerImpl$PythonConsoleRunParams and com.jetbrains.python.run.AbstractPythonRunConfiguration are in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader @77831d14)
at net.ashald.envfile.products.pycharm.PythonProvider.extendTargetEnvironment(PythonProvider.java:21)
at com.jetbrains.python.run.PythonCommandLineState.initEnvironment(PythonCommandLineState.java:648)
at com.jetbrains.python.run.PythonCommandLineState.initEnvironment(PythonCommandLineState.java:616)
at com.jetbrains.python.console.PydevConsoleRunnerImpl.doCreatePythonConsoleExecution(PydevConsoleRunnerImpl.java:455)
at com.jetbrains.python.console.PydevConsoleRunnerImpl.createPythonConsoleExecution(PydevConsoleRunnerImpl.java:403)
at com.jetbrains.python.console.PydevConsoleRunnerImpl.createProcessUsingTargetsAPI(PydevConsoleRunnerImpl.java:554)
at com.jetbrains.python.console.PydevConsoleRunnerImpl.initAndRun(PydevConsoleRunnerImpl.java:758)
at com.jetbrains.python.console.PydevConsoleRunnerImpl$1.run(PydevConsoleRunnerImpl.java:282)
at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:442)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:114)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsynchronously$5(CoreProgressManager.java:493)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$3(ProgressRunner.java:252)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:188)
at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$12(CoreProgressManager.java:608)
at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:683)
at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:639)
at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:607)
at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:60)
at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:175)
at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:252)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699)
at java.base/java.lang.Thread.run(Thread.java:833)
Thanks for the report @Vanderhoof, fixed in 3.2.5
Hey @HassanAbouelela, thanks so much for getting this working again.
I'm having issues with the Python Console not starting up in the project working directory or the one specified in the Python Console settings window.
I can add a os.chdir
call to the start of the console start script to get around this but thought it was worth mentioning
Hey, is this before or after the fix released yesterday (3.2.5)? Could you share the error message.
After the 3.2.5 fix as the console did not work at all before. Unfortunately there is no error message as the shell launches just fine. It just appears to be starting in the incorrect directory.
Edit: Also not ruling this out at a me issue as I can't replicate it in a new project window.
Off the top of my head, I can't think of anything in the code that'd affect the directory, however let me know if you manage to reproduce in an empty project.
If you'd like to debug your other project, disable the plugin and see if it still causes the issue.
Looks like it's entirely unrelated and specific to the Django Console. Thanks for the help!
It's exciting to see how many people use the plugin judging from the number of complaints about it breaking. I wish it correlated with number of Github Sponsor donations to support plugin development. Or at least with a number of pull requests contributing fixes.
I personally don't have a need to use the latest version of IDE and been perfectly fine using older versions, though as I plan to add few extra features I'll look into fixing compatibility with the latest versions.
@ashald I can't speak for anyone else but I personally would be willing to support you financially with Paypal if you had one linked on your profile. π Can't deny your plugin has been very helpful with my Pycharm usage
Sponsor here > https://github.com/sponsors/ashald
PS. @ashald please setup One-time tiers :)
Hi @ashald! Thank you for creating such a popular plugin! I work at JetBrains and we'll be happy to provide a pull request to fix 2022.2 compatibility! (we had a huge refactoring in the 2022.2 release and most likely that was the reason of the broken plugin). Unfortunately, we didn't notice it earlier.
Would you be interested in such pull request? (asking just to make sure you're not working on it at the moment, so we won't do the same job twice)
@ashald I am sorry, but it looked like you abandoned the repo. I am using @HassanAbouelela's fork at the moment.
@Elizaveta239 , ΠΌΠΎΠΆΠ΅Ρ Π²Ρ Π² JetBrains ΠΈΠΌΠΏΠ»Π΅ΠΌΠ΅Π½ΡΠΈΡΡΠ΅ΡΠ΅ Π½Π°ΡΡΠΎΠ»ΡΠΊΠΎ Π½Π΅ΠΎΠ±Ρ ΠΎΠ΄ΠΈΠΌΡΡ ΡΡΠ½ΠΊΡΠΈΠΎΠ½Π°Π»ΡΠ½ΠΎΡΡΡ Π½Π°ΠΏΡΡΠΌΡΡ Π² ΠΏΡΠΎΠ΄ΡΠΊΡΠ°Ρ Idea Π±Π΅Π· Π½Π°Π΄ΠΎΠ±Π½ΠΎΡΡΠΈ ΠΏΠ»Π°Π³ΠΈΠ½ΠΎΠ²? ΠΊΠ°ΠΊ ΡΠ°Π·, ΠΏΠΎΡΠ»Π΅ ΠΎΡΠΏΡΡΠΊΠ° Ρ Π½ΠΎΠ²ΡΠΌΠΈ ΡΠΈΠ»Π°ΠΌΠΈ. ΠΌ? ΡΡΡΠ΄Π½ΠΎ ΠΊΠΎΠΏΠΈΡΠΎΠ²Π°ΡΡ ΠΈΠ· Run Configuration Π² Run Configuration ΠΏΠ΅ΡΠ΅ΠΌΠ΅Π½Π½ΡΠ΅ ΡΡΠ΅Π΄Ρ ΡΠ°Π· Π·Π° ΡΠ°Π·ΠΎΠΌ ΠΈΠ·-Π·Π° Π±ΡΠΎΡΠ΅Π½Π½ΠΎΠ³ΠΎ ΡΠ΅ΠΏΠΎΠ·ΠΈΡΠΎΡΠΈΡ ΠΏΠ»Π°Π³ΠΈΠ½Π°. ΡΠΏΠ°ΡΠΈΠ±ΠΎ.
can you in JetBrains implement much-needed functionality directly in Idea products without the need for plugins? as times, after holiday with new forces. m? it's a shame to copy environment variables from Run Configuration to Run Configuration over and over again because of the abandoned plugin repository. Thanks.
We have plans to implement this functionality as part of the product but later. Implementing a fix for the existing popular plugin is the fastest solution we can provide at the moment. Sorry for the inconvenience!
Maybe you could just pay the authors to support the plugins and keep them in the loop for breaking changes.
The practice of using community contributors for free to discover what features are in demand, and them discarding their work in favor of internal implementations is questionable.
I guess you are the ones that should setup a sponsorship on @ashald account ;P
I think this change would've been apparent in early builds of 2022.2 but there definitely could've been more done to communicate any of this.
The refactoring was not documented anywhere to my knowledge, and not listed in the breaking changes list. The APIs are still accessible and documented, despite being unable to access them for some IDEs (IntelliJ). They are also inconsistently documented, with some of the APIs marking certain methods as deprecated (Go deprecated the function this plugin uses, but none of the other EPs nor the base EP have the same deprecation). I also heard about a new run API in the slack community, but I'm honestly not sure where that is.
(This is more feedback for plugins and documentation in general, not for plugin developers).
We have plans to implement this functionality as part of the product but later. Implementing a fix for the existing popular plugin is the fastest solution we can provide at the moment. Sorry for the inconvenience!
@Elizaveta239 just to clarify, you mean essentially make this plugin unnecessary?
@modernNeo thanks, noted - will update profile/readme to include links just in case you or anyone else would be feeling like doing so. π
@wooyek done!
@Elizaveta239 would appreciate a contribution! Please note I pushed some changes to update some of the dependencies. Also, would appreciate if you could clarify if the changes are only required for PyCharm, or if we should migrate to some new API for other platforms such as Goland/RubyMine.
And of course if such functionality would make make its way into JetBrains IDEs natively, I'd be more than happy to deprecate this plugin. Thought, IMHO, the best thing JetBrains could do is address https://youtrack.jetbrains.com/issue/IDEA-288756 so that not any developer willing to implement a plugin to add extra environment variables would have a cross-platform way to do so.
@RockyMM glad you found something that works for you! That being said, looking at your profile, you seem to have quite a few Java repos... which makes me wonder what stops people like you from contributing fixes rather than just commenting on issues like this, It's OSS after all.
@HassanAbouelela agree! the most challenging part of developing this plugin was to reverse-engineer ambiguous parts of plugin interface for run configurations.
I am getting empty environment variables on Python projects even I set a value after IntelliJ Update