NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.13k stars 14.17k forks source link

PyCharm Python debugger CPython extension fails on NixOS #29807

Open mkocha2 opened 7 years ago

mkocha2 commented 7 years ago

Issue description

Python debugger extension does not work on NixOS.

image

Steps to reproduce

Create a break point, "Debug it" (such that it stops at the break point and displays the above window), and then click on Install, which results in:

image

Technical details

FRidh commented 7 years ago

I don't know whether the issue really is the lack of the SHELL variable, but in any case, it won't be able to install the extension because the store is read-only.

datakurre commented 6 years ago

It should be possible to build those extensions build time.

@mkocha2 Would you know, how to confirm if those extensions have been successfully built? I tried to follow Jetbrain's documentation and build them in postInstall of PyCharm. From filesystem it looked like proper .so files were created, but I still got that notification.

--- a/pkgs/applications/editors/jetbrains/default.nix      2017-12-08 20:20:01.293558093 +0200
+++ b/pkgs/applications/editors/jetbrains/default.nix 2017-12-08 20:52:28.690932374 +0200
@@ -1,6 +1,6 @@
 { lib, stdenv, callPackage, fetchurl, makeDesktopItem, makeWrapper, patchelf
 , coreutils, gnugrep, which, git, python, unzip, p7zip
-, androidsdk, jdk, cmake, libxml2, zlib, python3, ncurses
+, androidsdk, jdk, cmake, libxml2, zlib, python3, pythonPackages, ncurses
 }:

 assert stdenv.isLinux;
@@ -167,9 +167,13 @@
         maintainers = with maintainers; [ jgeerds ];
         platforms = platforms.linux;
       };
-    }).override {
+    }).overrideAttrs (old: {
+      buildInputs = old.buildInputs ++ [ python pythonPackages.setuptools ];
       propagatedUserEnvPkgs = [ python ];
-    };
+      installPhase = old.installPhase + ''
+        python $out/pycharm-*/helpers/pydev/setup_cython.py build_ext --inplace
+      '';
+    });

   buildRider = { name, version, src, license, description, wmClass, update-channel }:
     lib.overrideDerivation (mkJetBrainsProduct rec {
memberbetty commented 5 years ago

I am hitting the same issue. @datakurre, can you open a PR with your change? It would become easier to contact their support if the .so is already on my system.

stale[bot] commented 4 years ago

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.
yeus commented 6 months ago

and solutions to this, 5 years later ;)?

here is an error report from the current version:

Non-zero exit code (1):

_pydevd_frame_eval/pydevd_frame_evaluator_39_310.c:771:10: fatal error: code.h: No such file or directory
771 | #include "code.h"
     |          ^~~~~~~~
compilation terminated.

Traceback (most recent call last):
  File "/home/tom/.cache/pypoetry/virtualenvs/mainline-alpha-rICXwQHJ-py3.10/lib/python3.10/site-packages/setuptools/_distutils/unixccompiler.py", line 185, in _compile
    self.spawn(compiler_so + cc_args + [src, '-o', obj] + extra_postargs)
  File "/home/tom/.cache/pypoetry/virtualenvs/mainline-alpha-rICXwQHJ-py3.10/lib/python3.10/site-packages/setuptools/_distutils/ccompiler.py", line 1041, in spawn
    spawn(cmd, dry_run=self.dry_run, **kwargs)
  File "/home/tom/.cache/pypoetry/virtualenvs/mainline-alpha-rICXwQHJ-py3.10/lib/python3.10/site-packages/setuptools/_distutils/spawn.py", line 70, in spawn
    raise DistutilsExecError(
distutils.errors.DistutilsExecError: command '/nix/store/ihhhd1r1a2wb4ndm24rnm83rfnjw5n0z-gcc-wrapper-12.3.0/bin/gcc' failed with exit code 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/tom/.cache/pypoetry/virtualenvs/mainline-alpha-rICXwQHJ-py3.10/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
    dist.run_commands()
  File "/home/tom/.cache/pypoetry/virtualenvs/mainline-alpha-rICXwQHJ-py3.10/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
    self.run_command(cmd)
  File "/home/tom/.cache/pypoetry/virtualenvs/mainline-alpha-rICXwQHJ-py3.10/lib/python3.10/site-packages/setuptools/dist.py", line 963, in run_command
    super().run_command(command)
  File "/home/tom/.cache/pypoetry/virtualenvs/mainline-alpha-rICXwQHJ-py3.10/lib/python3.10/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
    cmd_obj.run()
  File "/home/tom/.cache/pypoetry/virtualenvs/mainline-alpha-rICXwQHJ-py3.10/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 89, in run
    _build_ext.run(self)
  File "/home/tom/.cache/pypoetry/virtualenvs/mainline-alpha-rICXwQHJ-py3.10/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
    self.build_extensions()
  File "/home/tom/.cache/pypoetry/virtualenvs/mainline-alpha-rICXwQHJ-py3.10/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions
    self._build_extensions_serial()
  File "/home/tom/.cache/pypoetry/virtualenvs/mainline-alpha-rICXwQHJ-py3.10/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 493, in _build_extensions_serial
    self.build_extension(ext)
  File "/home/tom/.cache/pypoetry/virtualenvs/mainline-alpha-rICXwQHJ-py3.10/lib/python3.10/site-packages/setuptools/command/build_ext.py", line 250, in build_extension
    _build_ext.build_extension(self, ext)
  File "/home/tom/.cache/pypoetry/virtualenvs/mainline-alpha-rICXwQHJ-py3.10/lib/python3.10/site-packages/setuptools/_distutils/command/build_ext.py", line 548, in build_extension
    objects = self.compiler.compile(
  File "/home/tom/.cache/pypoetry/virtualenvs/mainline-alpha-rICXwQHJ-py3.10/lib/python3.10/site-packages/setuptools/_distutils/ccompiler.py", line 600, in compile
    self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
  File "/home/tom/.cache/pypoetry/virtualenvs/mainline-alpha-rICXwQHJ-py3.10/lib/python3.10/site-packages/setuptools/_distutils/unixccompiler.py", line 187, in _compile
    raise CompileError(msg)
distutils.errors.CompileError: command '/nix/store/ihhhd1r1a2wb4ndm24rnm83rfnjw5n0z-gcc-wrapper-12.3.0/bin/gcc' failed with exit code 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/nix/store/7q9fvn5zc7kbsas1x6652pfwcz575dgy-pycharm-community-2023.2.3/pycharm-community/plugins/python-ce/helpers/pydev/setup_cython.py", line 143, in build_extension
    setup(
  File "/home/tom/.cache/pypoetry/virtualenvs/mainline-alpha-rICXwQHJ-py3.10/lib/python3.10/site-packages/setuptools/__init__.py", line 103, in setup
    return distutils.core.setup(**attrs)
  File "/home/tom/.cache/pypoetry/virtualenvs/mainline-alpha-rICXwQHJ-py3.10/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 185, in setup
    return run_commands(dist)
  File "/home/tom/.cache/pypoetry/virtualenvs/mainline-alpha-rICXwQHJ-py3.10/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 215, in run_commands
    raise SystemExit("error: " + str(msg))
SystemExit: error: command '/nix/store/ihhhd1r1a2wb4ndm24rnm83rfnjw5n0z-gcc-wrapper-12.3.0/bin/gcc' failed with exit code 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/nix/store/7q9fvn5zc7kbsas1x6652pfwcz575dgy-pycharm-community-2023.2.3/pycharm-community/plugins/python-ce/helpers/pydev/setup_cython.py", line 151, in build_extension
    os.remove(new_pyx_file)
UnboundLocalError: local variable 'new_pyx_file' referenced before assignment

During handling of the above exception, another exception occurred:

...

error: command '/nix/store/ihhhd1r1a2wb4ndm24rnm83rfnjw5n0z-gcc-wrapper-12.3.0/bin/gcc' failed with exit code 1

I am not sure if its 100% correct, because pycharm only lets me copy a totally mangled up error report so I did code beautification using an LLM on it. I think its accurate though on first glance...

@GenericNerdyUsername @tymscar