question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support other package managers besides pip/conda

See original GitHub issue

I’m using PEP582 featured Python package manager (e.g. PyFlow or PDM) which installs local packages in {project_path}/__pypackages__ folder.

The problem is that I did not find a way to set Jupyter Server to find ipykernel in {project_path}/__pypackages__. VSCode asks me to install ipykernel by pip, but I’ve already install it locally in {project_path}/__pypackages__.

I need a way to run a Jupyter Cell (ctrl + enter) in my python code with #%% which would find the ipykernel in {project_path}/__pypackages__.

  1. How do I config Jupyter Server properly to find ipykernel in {project_path}/__pypackages__?
  2. How do I config {project_path}/__pypackages__ for Python package search paths?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
xareeleecommented, May 6, 2021

The problem you’re having is specific to using a different package manager. So the request would be more like support other package managers besides pip and conda.

Yes, If only trying to solve my specific problem.

For abstract thinking in problem solving, I think the problem is: how to eliminate different behavior when launching a VSCode workspace with different ways (make it consistent).

I think there are many ways to solve this abstract question:

  • specify additional module search paths for loading ipykernel in settings.json. (which currently is not available in general settings)
  • make PYTHONPATH support finding ipykernel before launching. (which currently is not working in settings.json)
  • give a way to setup environment for VSCode regardless how to launch it. (which currently is not working in .env)

That sys.path should be different if you run the same code from the gui launched VS code.

I found that setting $PYTHONPATH in VSCode doesn’t help launch python code by Command Palettes:

  • Run code
  • Python: Run Python File in Terminal
  • Jupyter: Run Current Cell

the sys.path will not contain my local packages (__pypackages__/3.7/lib).

I have no idea that is a bug or not. I need a way to load my local modules in Jupyter, including finding local ipykernel when launching.

The reason it works when you run from the command line is the environment is setup correctly to find the packages you installed with the other package manager. VS code will inherit the environment from the command line shell. In fact this is the recommended way to get VS code to find packages when using conda too.

Thanks for your info, I finally know what is going on here.

0reactions
DonJayamannecommented, Dec 1, 2022

Unfortunately there haven’t been enough upvotes on this feature request, hence closing this issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Which Python package manager should you use? | by Yufeng G
There are currently two popular options for taking care of managing your different pip packages: virtualenv and anaconda. Virtualenv. Virtualenv ...
Read more >
What is the difference between pip and conda? - Stack Overflow
Pip installs Python packages whereas conda installs packages which may contain software written in any language. For example, before using pip, a Python ......
Read more >
Alternatives to Pip - Real Python
There are a number of alternatives to pip that you may want to try. Conda is the package and environment manager that comes...
Read more >
Using Packages and Channels - The Carpentries Incubator
system-level libraries; Python or other modules; executable programs and other ... For reference, bioconda is a channel for the conda package manager ......
Read more >
Add Packages to the Package Management Environment
Use this API to add Python and R packages to a Package Management ... Qubole provides other endpoints to access QDS that are...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found