NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.43k stars 13.64k forks source link

Request to package the python package jediepcserver with nix, to enable interactive-development-environment/language-server support in emacs-ipython-notebook: #136838

Open zeta-00 opened 3 years ago

zeta-00 commented 3 years ago

Project description

Issue description

describe the project a little I'm having trouble installing the python package jediepcserver in emacs doing M-x jedi:install-server. It throws a permission denied error? Anyways, it would be cool if we could package this as a nixpkg, so that we can place the package in shell.nix files for isolated python environments. Elpy is the official emacs package supported by emacs-ipython-notebook, in which elpy provides the ide support, but elpy depends on jedi and this jedi server to be able to run, so I'm stuck. I'll run my python notebooks in emacs without ide support for now, but I hope that we can fix this soon! Thanks in advance for the help!

Note: I'm runing nixos-darwin/home-manager on an m1 mac mini machine, with nix setup to install nix packages natively on apple silicon.

Steps to reproduce:

Emacs meta command: M-x jedi:install-server

Technical details

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result:

apple@tomass-Mac-mini> nix-shell -p nix-info --run "nix-info -m" ~

apple@tomass-Mac-mini> nix show-config | grep system ~ system = aarch64-darwin system-features = benchmark big-parallel nixos-test apple@tomass-Mac-mini> ~

Metadata https://github.com/tkf/emacs-jedi/blob/master/jediepcserver.py https://github.com/millejoh/emacs-ipython-notebook#how-do-i http://tkf.github.io/emacs-jedi/latest/

Attached below is my shell.nix config, and the error message that is being thrown by emacs:

shell.nix:

paste in terminal:

echo "use nix" >> .envrc

direnv allow

direnv deny (to disable direnv)

{ pkgs ? import {} }: let pythonEnv = pkgs.python39.withPackages (ps: with ps; [ numpy matplotlib toolz

  # ipython for interactive computing:
  # jupyter
  # jupyter_client
  # jupyter_console
  ipython
  ipykernel
  ipywidgets
  widgetsnbextension
  ipyparallel
  pkgs.nbstripout
  nbmerge
  # vega
  virtualenv

  # python autocompletion tool:
  jedi

  # python-language-server installation:
  # python-language-server
  # extra plugins for python-lsp:
  # pyls-mypy

  # pyls-isort

  # pyls-black
  # rope
  # pyflakes
  # mccabe
  # pycodestyle
  # pydocstyle
  # autopep8
  # yapf

  # pyppeteer, used to convert .ipnb file to a pdf:
  # pyppeteer
  pip
  # pyinstaller
]);

in with pkgs; mkShell { nativeBuildInputs = with pkgs; [ pythonEnv

    # atom text editor:
    # atom

    # pandoc, used for conversion between markup formats:
    # pandoc

    # required for nix-direnv:
    # bashInteractive
  ];

}

emacs error:

Loading /nix/store/k0kw31fg9h618vfz4nz1mgkqrwkpsy91-emacs-pgtkgcc-20210816.0/share/emacs/site-lisp/site-start.el (source)...done Loading /Users/apple/.emacs.d/module-elisp/autocomplete.el (source)...done Loading /Users/apple/.emacs.d/module-elisp/backups.el (source)...done Loading /Users/apple/.emacs.d/module-elisp/code-snippets.el (source)...done Loading /Users/apple/.emacs.d/module-elisp/debug.el (source)...done Loading /Users/apple/.emacs.d/module-elisp/direnv.el (source)...done Loading /Users/apple/.emacs.d/module-elisp/emacs-interactive-notebook.el (source)...done Loading /Users/apple/.emacs.d/module-elisp/emacs-web-server.el (source)...done Loading /Users/apple/.emacs.d/module-elisp/file-explorer.el (source)...done Loading /Users/apple/.emacs.d/module-elisp/font.el (source)...done Loading /Users/apple/.emacs.d/module-elisp/keybindings.el (source)...done Loading /Users/apple/.emacs.d/module-elisp/language-servers.el (source)...done Loading /Users/apple/.emacs.d/module-elisp/paste.el (source)...done Loading /Users/apple/.emacs.d/module-elisp/pdf-tooling.el (source)...done Loading /Users/apple/.emacs.d/module-elisp/shell.el (source)...done Loading /Users/apple/.emacs.d/module-elisp/themes.el (source)...done Loading /Users/apple/.emacs.d/module-elisp/version-control.el (source)...done For information about GNU Emacs and the GNU system, type C-h C-a. End of buffer [9 times] Mark set Saving file /Users/apple/.config/nixpkgs/home.nix... Wrote /Users/apple/.config/nixpkgs/home.nix Saving file /Users/apple/.config/nixpkgs/home.nix... Wrote /Users/apple/.config/nixpkgs/home.nix (No changes need to be saved) Beginning of buffer [4 times] direnv: +AR +AS +CC +CONFIG_SHELL +CXX +HOST_PATH +IN_NIX_SHELL +LD +LD_DYLD_PATH +MACOSX_DEPLOYMENT_TARGET +NIX_BINTOOLS +NIX_BINTOOLS_WRAPPER_TARGET_HOST_aarch64_apple_darwin +NIX_BUILD_CORES +NIX_BUILD_TOP +NIX_CC +NIX_CC_WRAPPER_TARGET_HOST_aarch64_apple_darwin +NIX_CFLAGS_COMPILE +NIX_COREFOUNDATION_RPATH +NIX_DONT_SET_RPATH +NIX_DONT_SET_RPATH_FOR_BUILD +NIX_ENFORCE_NO_NATIVE +NIX_HARDENING_ENABLE +NIX_IGNORE_LD_THROUGH_GCC +NIX_INDENT_MAKE +NIX_LDFLAGS +NIX_NO_SELF_RPATH +NIX_STORE +NM +PATH_LOCALE +RANLIB +SIZE +SOURCE_DATE_EPOCH +STRINGS +STRIP +TEMP +TEMPDIR +TMP +ETC_PROFILE_SOURCED +darwinAllowLocalNetworking +impureHostDeps +propagatedImpureHostDeps +propagatedSandboxProfile +sandboxProfile +buildInputs +builder +configureFlags +depsBuildBuild +depsBuildBuildPropagated +depsBuildTarget +depsBuildTargetPropagated +depsHostHost +depsHostHostPropagated +depsTargetTarget +depsTargetTargetPropagated +doCheck +doInstallCheck +gl_cv_func_getcwd_abort_bug +name +nativeBuildInputs +nobuildPhase +out +outputs +patches +phases +propagatedBuildInputs +propagatedNativeBuildInputs +shell +shellHook +stdenv +strictDeps +system ~PATH ~TMPDIR ~XDG_DATA_DIRS (~/.config/nixpkgs → ~/coding-projects/python/interactive-python) Beginning of buffer [3 times] Running: pip install --upgrade /nix/store/d9fdadway46fnm8bka2apb18awqvfa32-emacs-packages-deps/share/emacs/site-lisp/elpa/jedi-core-20210503.1315/...Done deferred error : (error "Deferred process exited abnormally: command: /Users/apple/.emacs.d/.python-environments/default/bin/pip exit status: exit 1 event: exited abnormally with code 1 buffer contents: \"Processing /nix/store/d9fdadway46fnm8bka2apb18awqvfa32-emacs-packages-deps/share/emacs/site-lisp/elpa/jedi-core-20210503.1315  DEPRECATION: A future pip version will change local packages to be built in-place without first copying to a temporary directory. We recommend you use --use-feature=in-tree-build to test your packages with this new behavior before it becomes the default. pip 21.3 will remove support for this functionality. You can find discussion regarding this at https://github.com/pypa/pip/issues/7555. Requirement already satisfied: jedi>=0.11.0 in /Users/apple/.emacs.d/.python-environments/default/lib/python3.9/site-packages (from jediepcserver==0.3.0) (0.18.0) Requirement already satisfied: epc>=0.0.4 in /Users/apple/.emacs.d/.python-environments/default/lib/python3.9/site-packages (from jediepcserver==0.3.0) (0.0.5) Collecting argparse Using cached argparse-1.4.0-py2.py3-none-any.whl (23 kB) Requirement already satisfied: setuptools in /Users/apple/.emacs.d/.python-environments/default/lib/python3.9/site-packages (from jediepcserver==0.3.0) (57.0.0) Requirement already satisfied: sexpdata>=0.0.3 in /Users/apple/.emacs.d/.python-environments/default/lib/python3.9/site-packages (from epc>=0.0.4->jediepcserver==0.3.0) (0.0.3) Requirement already satisfied: parso<0.9.0,>=0.8.0 in /Users/apple/.emacs.d/.python-environments/default/lib/python3.9/site-packages (from jedi>=0.11.0->jediepcserver==0.3.0) (0.8.2) Building wheels for collected packages: jediepcserver Building wheel for jediepcserver (setup.py) ... [?25l- error  ERROR: Command errored out with exit status 1: command: /Users/apple/.emacs.d/.python-environments/default/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '\\"'\\"'/private/tmp/pip-req-build-kebf6azh/setup.py'\\"'\\"'; file='\\"'\\"'/private/tmp/pip-req-build-kebf6azh/setup.py'\\"'\\"';f = getattr(tokenize, '\\"'\\"'open'\\"'\\"', open)(file) if os.path.exists(file) else io.StringIO('\\"'\\"'from setuptools import setup; setup()'\\"'\\"');code = f.read().replace('\\"'\\"'\\r\\n'\\"'\\"', '\\"'\\"'\\n'\\"'\\"');f.close();exec(compile(code, file, '\\"'\\"'exec'\\"'\\"'))' bdist_wheel -d /private/tmp/pip-wheel-m6f73t76 cwd: /private/tmp/pip-req-build-kebf6azh/ Complete output (5 lines): running bdist_wheel running build running build_py creating build error: could not create 'build': Permission denied ----------------------------------------  ERROR: Failed building wheel for jediepcserver [?25h Running setup.py clean for jediepcserver Failed to build jediepcserver Installing collected packages: argparse, jediepcserver Running setup.py install for jediepcserver ... [?25l- error  ERROR: Command errored out with exit status 1: command: /Users/apple/.emacs.d/.python-environments/default/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '\\"'\\"'/private/tmp/pip-req-build-kebf6azh/setup.py'\\"'\\"'; file='\\"'\\"'/private/tmp/pip-req-build-kebf6azh/setup.py'\\"'\\"';f = getattr(tokenize, '\\"'\\"'open'\\"'\\"', open)(file) if os.path.exists(file) else io.StringIO('\\"'\\"'from setuptools import setup; setup()'\\"'\\"');code = f.read().replace('\\"'\\"'\\r\\n'\\"'\\"', '\\"'\\"'\\n'\\"'\\"');f.close();exec(compile(code, file, '\\"'\\"'exec'\\"'\\"'))' install --record /private/tmp/pip-record-hos36s4z/install-record.txt --single-version-externally-managed --compile --install-headers /Users/apple/.emacs.d/.python-environments/default/include/site/python3.9/jediepcserver cwd: /private/tmp/pip-req-build-kebf6azh/ Complete output (5 lines): running install running build running build_py creating build error: could not create 'build': Permission denied ---------------------------------------- ERROR: Command errored out with exit status 1: /Users/apple/.emacs.d/.python-environments/default/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '\\"'\\"'/private/tmp/pip-req-build-kebf6azh/setup.py'\\"'\\"'; file='\\"'\\"'/private/tmp/pip-req-build-kebf6azh/setup.py'\\"'\\"';f = getattr(tokenize, '\\"'\\"'open'\\"'\\"', open)(file) if os.path.exists(file) else io.StringIO('\\"'\\"'from setuptools import setup; setup()'\\"'\\"');code = f.read().replace('\\"'\\"'\\r\\n'\\"'\\"', '\\"'\\"'\\n'\\"'\\"');f.close();exec(compile(code, file, '\\"'\\"'exec'\\"'\\"'))' install --record /private/tmp/pip-record-hos36s4z/install-record.txt --single-version-externally-managed --compile --install-headers /Users/apple/.emacs.d/.python-environments/default/include/site/python3.9/jediepcserver Check the logs for full command output. WARNING: You are using pip version 21.1.2; however, version 21.2.4 is available. You should consider upgrading via the '/Users/apple/.emacs.d/.python-environments/default/bin/python -m pip install --upgrade pip' command. [?25hTraceback (most recent call last): File \\"/nix/store/cyxzy69if1y08vbxwp62cxal3ahllqr0-python3-3.9.6/lib/python3.9/shutil.py\\", line 673, in _rmtree_safe_fd os.unlink(entry.name, dir_fd=topfd) PermissionError: [Errno 13] Permission denied: 'jedi-core-pkg.el'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File \\"/Users/apple/.emacs.d/.python-environments/default/bin/pip\\", line 8, in sys.exit(main()) File \\"/Users/apple/.emacs.d/.python-environments/default/lib/python3.9/site-packages/pip/_internal/cli/main.py\\", line 71, in main return command.main(cmd_args) File \\"/Users/apple/.emacs.d/.python-environments/default/lib/python3.9/site-packages/pip/_internal/cli/base_command.py\\", line 104, in main return self._main(args) File \\"/nix/store/cyxzy69if1y08vbxwp62cxal3ahllqr0-python3-3.9.6/lib/python3.9/contextlib.py\\", line 124, in exit next(self.gen) File \\"/Users/apple/.emacs.d/.python-environments/default/lib/python3.9/site-packages/pip/_internal/cli/command_context.py\\", line 22, in main_context yield File \\"/nix/store/cyxzy69if1y08vbxwp62cxal3ahllqr0-python3-3.9.6/lib/python3.9/contextlib.py\\", line 513, in exit raise exc_details[1] File \\"/nix/store/cyxzy69if1y08vbxwp62cxal3ahllqr0-python3-3.9.6/lib/python3.9/contextlib.py\\", line 135, in exit self.gen.throw(type, value, traceback) File \\"/Users/apple/.emacs.d/.python-environments/default/lib/python3.9/site-packages/pip/_internal/utils/temp_dir.py\\", line 75, in tempdir_registry yield _tempdir_registry File \\"/nix/store/cyxzy69if1y08vbxwp62cxal3ahllqr0-python3-3.9.6/lib/python3.9/contextlib.py\\", line 498, in exit if cb(exc_details): File \\"/nix/store/cyxzy69if1y08vbxwp62cxal3ahllqr0-python3-3.9.6/lib/python3.9/contextlib.py\\", line 124, in exit next(self.gen) File \\"/Users/apple/.emacs.d/.python-environments/default/lib/python3.9/site-packages/pip/_internal/utils/temp_dir.py\\", line 37, in global_tempdir_manager _tempdir_manager = old_tempdir_manager File \\"/nix/store/cyxzy69if1y08vbxwp62cxal3ahllqr0-python3-3.9.6/lib/python3.9/contextlib.py\\", line 513, in exit raise exc_details[1] File \\"/nix/store/cyxzy69if1y08vbxwp62cxal3ahllqr0-python3-3.9.6/lib/python3.9/contextlib.py\\", line 498, in exit if cb(exc_details): File \\"/Users/apple/.emacs.d/.python-environments/default/lib/python3.9/site-packages/pip/_internal/utils/temp_dir.py\\", line 165, in exit self.cleanup() File \\"/Users/apple/.emacs.d/.python-environments/default/lib/python3.9/site-packages/pip/_internal/utils/temp_dir.py\\", line 184, in cleanup rmtree(self._path) File \\"/Users/apple/.emacs.d/.python-environments/default/lib/python3.9/site-packages/pip/_vendor/tenacity/init.py\\", line 339, in wrapped_f return self(f, *args, *kw) File \\"/Users/apple/.emacs.d/.python-environments/default/lib/python3.9/site-packages/pip/_vendor/tenacity/init.py\\", line 430, in call do = self.iter(retry_state=retry_state) File \\"/Users/apple/.emacs.d/.python-environments/default/lib/python3.9/site-packages/pip/_vendor/tenacity/init.py\\", line 378, in iter raise retry_exc.reraise() File \\"/Users/apple/.emacs.d/.python-environments/default/lib/python3.9/site-packages/pip/_vendor/tenacity/init.py\\", line 206, in reraise raise self.last_attempt.result() File \\"/nix/store/cyxzy69if1y08vbxwp62cxal3ahllqr0-python3-3.9.6/lib/python3.9/concurrent/futures/_base.py\\", line 438, in result return self.get_result() File \\"/nix/store/cyxzy69if1y08vbxwp62cxal3ahllqr0-python3-3.9.6/lib/python3.9/concurrent/futures/_base.py\\", line 390, in get_result raise self._exception File \\"/Users/apple/.emacs.d/.python-environments/default/lib/python3.9/site-packages/pip/_vendor/tenacity/init.py\\", line 433, in call result = fn(args, **kwargs) File \\"/Users/apple/.emacs.d/.python-environments/default/lib/python3.9/site-packages/pip/_internal/utils/misc.py\\", line 135, in rmtree shutil.rmtree(dir, ignore_errors=ignore_errors, onerror=rmtree_errorhandler) File \\"/nix/store/cyxzy69if1y08vbxwp62cxal3ahllqr0-python3-3.9.6/lib/python3.9/shutil.py\\", line 718, in rmtree _rmtree_safe_fd(fd, path, onerror) File \\"/nix/store/cyxzy69if1y08vbxwp62cxal3ahllqr0-python3-3.9.6/lib/python3.9/shutil.py\\", line 675, in _rmtree_safe_fd onerror(os.unlink, fullname, sys.exc_info()) File \\"/Users/apple/.emacs.d/.python-environments/default/lib/python3.9/site-packages/pip/_internal/utils/misc.py\\", line 151, in rmtree_errorhandler os.chmod(path, stat.S_IWRITE) PermissionError: [Errno 1] Operation not permitted: '/private/tmp/pip-req-build-kebf6azh/jedi-core-pkg.el' \"") direnv: ~PATH ~TMPDIR ~XDG_DATA_DIRS -AR -AS -CC -CONFIG_SHELL -CXX -HOST_PATH -IN_NIX_SHELL -LD -LD_DYLD_PATH -MACOSX_DEPLOYMENT_TARGET -NIX_BINTOOLS -NIX_BINTOOLS_WRAPPER_TARGET_HOST_aarch64_apple_darwin -NIX_BUILD_CORES -NIX_BUILD_TOP -NIX_CC -NIX_CC_WRAPPER_TARGET_HOST_aarch64_apple_darwin -NIX_CFLAGS_COMPILE -NIX_COREFOUNDATION_RPATH -NIX_DONT_SET_RPATH -NIX_DONT_SET_RPATH_FOR_BUILD -NIX_ENFORCE_NO_NATIVE -NIX_HARDENING_ENABLE -NIX_IGNORE_LD_THROUGH_GCC -NIX_INDENT_MAKE -NIX_LDFLAGS -NIX_NO_SELF_RPATH -NIX_STORE -NM -PATH_LOCALE -RANLIB -SIZE -SOURCE_DATE_EPOCH -STRINGS -STRIP -TEMP -TEMPDIR -TMP -ETC_PROFILE_SOURCED -darwinAllowLocalNetworking -impureHostDeps -propagatedImpureHostDeps -propagatedSandboxProfile -sandboxProfile -buildInputs -builder -configureFlags -depsBuildBuild -depsBuildBuildPropagated -depsBuildTarget -depsBuildTargetPropagated -depsHostHost -depsHostHostPropagated -depsTargetTarget -depsTargetTargetPropagated -doCheck -doInstallCheck -gl_cv_func_getcwd_abort_bug -name -nativeBuildInputs -nobuildPhase -out -outputs -patches -phases -propagatedBuildInputs -propagatedNativeBuildInputs -shell -shellHook -stdenv -strictDeps -system (~/coding-projects/python/interactive-python → ~/.config/nixpkgs) direnv: +AR +AS +CC +CONFIG_SHELL +CXX +HOST_PATH +IN_NIX_SHELL +LD +LD_DYLD_PATH +MACOSX_DEPLOYMENT_TARGET +NIX_BINTOOLS +NIX_BINTOOLS_WRAPPER_TARGET_HOST_aarch64_apple_darwin +NIX_BUILD_CORES +NIX_BUILD_TOP +NIX_CC +NIX_CC_WRAPPER_TARGET_HOST_aarch64_apple_darwin +NIX_CFLAGS_COMPILE +NIX_COREFOUNDATION_RPATH +NIX_DONT_SET_RPATH +NIX_DONT_SET_RPATH_FOR_BUILD +NIX_ENFORCE_NO_NATIVE +NIX_HARDENING_ENABLE +NIX_IGNORE_LD_THROUGH_GCC +NIX_INDENT_MAKE +NIX_LDFLAGS +NIX_NO_SELF_RPATH +NIX_STORE +NM +PATH_LOCALE +RANLIB +SIZE +SOURCE_DATE_EPOCH +STRINGS +STRIP +TEMP +TMP +ETC_PROFILE_SOURCED +darwinAllowLocalNetworking +impureHostDeps +propagatedImpureHostDeps +propagatedSandboxProfile +sandboxProfile +buildInputs +builder +configureFlags +depsBuildBuild +depsBuildBuildPropagated +depsBuildTarget +depsBuildTargetPropagated +depsHostHost +depsHostHostPropagated +depsTargetTarget +depsTargetTargetPropagated +doCheck +doInstallCheck +gl_cv_func_getcwd_abort_bug +name +nativeBuildInputs +nobuildPhase +out +outputs +patches +phases +propagatedBuildInputs +propagatedNativeBuildInputs +shell +shellHook +stdenv +strictDeps +system ~PATH ~TMPDIR ~XDG_DATA_DIRS (~/.config/nixpkgs → ~/coding-projects/python/interactive-python) Error in menu-bar-update-hook (term--update-term-menu): (wrong-type-argument keymapp nil) Beginning of buffer [34 times] End of buffer [5 times] C-c C-p C-f is undefined Copied URL to clipboard: "https://dpaste.org/mpLE" End of buffer [2 times] Beginning of buffer [23 times] Mark set [2 times] Copied text until "2 times] Beginning of buffer [23 times] " Mark set [2 times] Copied text until "times] Beginning of buffer [23 times] " [2 times]

stale[bot] commented 2 years ago

I marked this as stale due to inactivity. → More info