0

I normally run my notebooks from Jupyterlab Desktop and often I utilize the native built-in environment jlab_server (/Users/my_username/Library/jupyterlab-desktop/jlab_server/bin/python) to run notebook commands. If I need to install something I just run !PIP install command and it worked well.

However, I have a hard time uninstalling or downgrading certain packages because they often have a prompt for Y/n which in the notebook I can’t seems to be able to pass input.

So my question is how do you manage this native built-in environment from the terminal?

Also, does anyone know how to pass input into a Jupyter Notebook cell?

In terminal, I navigate to where jlab_server enviornment but running conda activate jlab_server doesn't seem to work. I am not sure if virtualenv or pipenv will work either.

Billy Zhao
  • 21
  • 1
  • So you know, in modern jupyter, it should be `%pip install` command. The exclamation point in conjunction with install commands can causes issues so the magic `%pip install` and `%conda install` commands were added to insure installation occurs in the environment being used by the kernel underlying the notebook, see [here](https://discourse.jupyter.org/t/why-users-can-install-modules-from-pip-but-not-from-conda/10722/4?u=fomightez) for more about the modern magic install command. ... – Wayne Apr 24 '23 at 00:47
  • See [the second paragraph here](https://discourse.jupyter.org/t/location-of-libraries-or-extensions-installed-in-jupyterlab/16303/2?u=fomightez) for why to avoid exclamation point with install command. **And you can pass in a `-y` for conda at least. See examples under Step #6 [here](https://medium.com/gft-engineering/macbook-m1-tensorflow-on-jupyter-notebooks-6171e1f48060). Put the magic command in front of `conda install` so it is something like `%conda install -c conda-forge pandas -y`. ... – Wayne Apr 24 '23 at 01:01
  • See [this answer to 'conda stuck on Proceed ([y]/n)? when updating packages in ipython console'](https://stackoverflow.com/a/40022547/8508004). Or answers to [pip install & uninstall recursively in non-interactive mode](https://stackoverflow.com/a/56383102/8508004), but substitute in use of magic `%conda install` command instead of using exclamation point with it. – Wayne Apr 24 '23 at 01:03
  • Just noticed you cross-posted [here](https://discourse.jupyter.org/t/how-do-you-manage-the-built-in-jlab-server-environment-from-terminal/19078?u=fomightez). Cross-posting without linking to each and every other cross-post in your own posts is frowned on. It leads to multiple people saying the same things in multiple places, thus wasting the time of those trying to help you. Additionally, it makes it hard to find the solution. If the cross-posts aren't linked, a person with the same issue seeing your Discourse post wouldn't know a solution is posted here. – Wayne Apr 24 '23 at 02:17
  • I wonder if [this issue resolution](https://github.com/jupyterlab/jupyterlab-desktop/issues/438#issuecomment-1405933966) and the preceding discussion may help with, "how do you manage this native built-in environment from the terminal?"? – Wayne Apr 24 '23 at 02:25
  • Thanks for the solution provided. I am testing them out right now. Just wondering if there's a way to access the Jlab_server environment from the terminal like how you access them in conda? – Billy Zhao Apr 26 '23 at 15:05

0 Answers0