InSyncWithFoo / ryecharm

The all-in-one PyCharm plugin for Astral-backed Python tools
https://insyncwithfoo.github.io/ryecharm/
MIT License
65 stars 2 forks source link

Exception in plugin when opening project without `pyproject.toml` file #1

Closed mtr closed 1 month ago

mtr commented 1 month ago

What happened?

I'm trying out RyeCharm in a new project that I'm working on. However, I also need to open some older projects that don't have any pyproject.toml file, and that causes an exception in the RyeCharm plugin.

Steps to reproduce

Open an existing project that don't have any pyproject.toml file.

Information about the system and installed versions:

PyCharm 2024.2.1 (Professional Edition)
Build #PY-242.21829.153, built on August 29, 2024
[…]
Runtime version: 21.0.3+13-b509.11 amd64 (JCEF 122.1.9)
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.awt.X11.XToolkit
Linux 6.8.0-41-generic
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 10240M
Cores: 32
Registry:
  ide.balloon.shadow.size=0
  debugger.watches.in.variables=false
  debugger.new.tool.window.layout=true
  ide.experimental.ui=true
  i18n.locale=
  editor.minimap.enabled=true
Non-Bundled Plugins:
  net.sjrx.intellij.plugins.systemdunitfiles (223.240904.242)
  com.redhat.devtools.lsp4ij (0.4.0)
  String Manipulation (9.14.1)
  com.intellij.mermaid (0.0.22+IJ.232)
  lermitage.intellij.extra.icons (2024.7.1)
  com.wakatime.intellij.plugin (15.0.2)
  com.intellij.ml.llm (242.21829.196)
  com.koxudaxi.ruff (0.0.36)
  com.lark.syntax (0.2)
  org.tonybaloney.security.pycharm-security (1.29.0)
  insyncwithfoo.ryecharm (0.1.0-alpha-1)
  pro.bashsupport (4.2.4.242)
  com.taff.plugin.orchide (2023.1.6.0-2022.3)
  org.jetbrains.plugins.gitlab (242.21829.162)
  org.jetbrains.plugins.github (242.21829.162)
  com.intellij.lang.jsgraphql (242.21829.3)
  JSTestDriver Plugin (202.5)
  io.wisetime.plugins.window.branch (2.0.0)
  com.mallowigi (97.0.0)
  mobi.hsz.idea.gitignore (4.5.3)
Current Desktop: ubuntu:GNOME

Relevant log output or stack trace

Unhandled exception in [ComponentManager(ProjectImpl@1139453574), CoroutineName(org.jetbrains.plugins.notebooks.jupyter.connections.execution.JupyterExecutionQueueManager), Dispatchers.Default]

org.jetbrains.plugins.notebooks.jupyter.connections.exceptions.JupyterManagedServerExited: Jupyter server process failed to start
{"stdout":"","stderr":"error: No `pyproject.toml` found in current directory or any parent directory\n","exitCode":2,"isTimeout":false,"isCancelled":false}
    at com.intellij.jupyter.py.server.JupyterServerExecutionImpl.setJupyterServerFinishedState(JupyterServerExecutionImpl.kt:66)
    at com.intellij.jupyter.py.server.JupyterServerExecutionImpl.setJupyterServerFinishedState$default(JupyterServerExecutionImpl.kt:63)
    at com.intellij.jupyter.py.server.JupyterServerExecutionImpl.startServer(JupyterServerExecutionImpl.kt:164)
    at com.intellij.jupyter.py.server.OldJupyterServerServiceImpl$startManagedServer$$inlined$runBackgroundableTask$1.run(progress.kt:52)
    at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:477)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:133)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsynchronously$6(CoreProgressManager.java:528)
    at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:249)
    at com.intellij.openapi.progress.ProgressManager.lambda$runProcess$0(ProgressManager.java:98)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:221)
    at com.intellij.platform.diagnostic.telemetry.helpers.TraceKt.use(trace.kt:49)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:220)
    at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$13(CoreProgressManager.java:660)
    at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:735)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:691)
    at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:659)
    at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:79)
    at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:202)
    at com.intellij.openapi.progress.ProgressManager.runProcess(ProgressManager.java:98)
    at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$5(ProgressRunner.java:249)
    at com.intellij.openapi.progress.impl.ProgressRunner$ProgressRunnable.run(ProgressRunner.java:501)
    at com.intellij.openapi.progress.impl.ProgressRunner.lambda$launchTask$18(ProgressRunner.java:466)
    at com.intellij.util.concurrency.ChildContext$runAsCoroutine$1.invoke(propagation.kt:92)
    at com.intellij.util.concurrency.ChildContext$runAsCoroutine$1.invoke(propagation.kt:92)
    at com.intellij.util.concurrency.ChildContext.runAsCoroutine(propagation.kt:97)
    at com.intellij.util.concurrency.ChildContext.runAsCoroutine(propagation.kt:92)
    at com.intellij.openapi.progress.impl.ProgressRunner.lambda$launchTask$19(ProgressRunner.java:464)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:735)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:732)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
    at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:732)
    at java.base/java.lang.Thread.run(Thread.java:1583)
    Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [ComponentManager(ProjectImpl@1139453574), CoroutineName(org.jetbrains.plugins.notebooks.jupyter.connections.execution.JupyterExecutionQueueManager), StandaloneCoroutine{Cancelled}@1d3c7314, Dispatchers.Default]
Caused by: insyncwithfoo.ryecharm.uv.managing.UVReportedError: {"stdout":"","stderr":"error: No `pyproject.toml` found in current directory or any parent directory\n","exitCode":2,"isTimeout":false,"isCancelled":false}
    at insyncwithfoo.ryecharm.uv.managing.UVPackageManager.runAndGetResult-gIAlu-s(UVPackageManager.kt:110)
    at insyncwithfoo.ryecharm.uv.managing.UVPackageManager.installPackage-gIAlu-s(UVPackageManager.kt:98)
    at com.jetbrains.python.packaging.PyPackageInstallUtils.installPackage-yxL6bBk(PyPackageInstallUtils.kt:64)
    at com.jetbrains.python.packaging.PyPackageInstallUtils.installPackage-yxL6bBk$default(PyPackageInstallUtils.kt:59)
    at com.intellij.jupyter.py.connections.management.JupyterManagementUtils$detectDefaultCommand$1.invokeSuspend(JupyterManagementUtils.kt:53)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
    at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:277)
    at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:111)
    at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$BuildersKt__BuildersKt(Builders.kt:84)
    at kotlinx.coroutines.BuildersKt__BuildersKt.runBlockingWithParallelismCompensation(Builders.kt:60)
    at kotlinx.coroutines.BuildersKt.runBlockingWithParallelismCompensation(Unknown Source)
    at kotlinx.coroutines.internal.intellij.IntellijCoroutines.runBlockingWithParallelismCompensation(intellij.kt:41)
    at com.intellij.openapi.progress.CoroutinesKt$runBlockingCancellable$1.invoke(coroutines.kt:146)
    at com.intellij.openapi.progress.CoroutinesKt$runBlockingCancellable$1.invoke(coroutines.kt:139)
    at com.intellij.openapi.progress.ContextKt.prepareIndicatorThreadContext$lambda$5(context.kt:109)
    at com.intellij.openapi.progress.impl.CoreProgressManager.silenceGlobalIndicator(CoreProgressManager.java:1027)
    at com.intellij.openapi.progress.ContextKt.prepareIndicatorThreadContext(context.kt:107)
    at com.intellij.openapi.progress.ContextKt.prepareThreadContext(context.kt:77)
    at com.intellij.openapi.progress.CoroutinesKt.runBlockingCancellable(coroutines.kt:139)
    at com.intellij.openapi.progress.CoroutinesKt.runBlockingMaybeCancellable(coroutines.kt:175)
    at com.intellij.jupyter.py.connections.management.JupyterManagementUtils.detectDefaultCommand(JupyterManagementUtils.kt:52)
    at com.intellij.jupyter.py.connections.management.JupyterManagementUtils.detectDefaultCommand$default(JupyterManagementUtils.kt:23)
    at com.intellij.jupyter.py.connections.management.JupyterServerCommandsKt.createJupyterStartCommandLine(JupyterServerCommands.kt:81)
    at com.intellij.jupyter.py.server.JupyterServerExecutionImpl.startServer(JupyterServerExecutionImpl.kt:111)
    ... 31 more

Operating system

Linux

InSyncWithFoo commented 1 month ago

Thanks for trying out the plugin and for the bug report!

Do you perhaps have the "Use uv for packaging operations" global setting enabled? It should be disabled by default. Only when this setting is enabled will the default package manager be overridden for projects that were not generated using the uv panel.

If this is the case, try disabling it and only turn it on for projects with a valid pyproject.toml.

InSyncWithFoo commented 1 month ago

v0.1.0-alpha-2 added a new setting to explicitly configure uv as the project's package manager even if the project wasn't generated using the uv panel. It should help clarifying the working details.

Should any problems arise, please reply here or open a new issue with more information.