GithubHelp home page GithubHelp logo

Comments (11)

betatim avatar betatim commented on August 13, 2024 1

Have you tried:

I had thought that that directory was write protected so that the only way to install a new package would be pip install --user there which installs it in the user's home directory. This will survive logouts etc.

I've never investigated but maybe you can set default arguments/options for pip in its config file? That would let you add --user as a default argument. Though for teaching purposes I'd spend 2min on explaining that pip install --user is the way to install something instead of doing "magic".

from hub-ops.

betatim avatar betatim commented on August 13, 2024

I'd say the answer is "maybe". Any changes made outside of a users home directory are indeed lost across logout/login. However there shouldn't be that many locations the student can write to outside of their home directory.

It would be good to know how they updated earthpy so we can try those commands exactly to reproduce it.

from hub-ops.

lwasser avatar lwasser commented on August 13, 2024

Ok. I presume they did a pip install at the terminal and then each time they log back in it rolls back. I was wondering if the docker ok mage takes precedent over any custom envt options?

from hub-ops.

betatim avatar betatim commented on August 13, 2024

pip install there (as an example) works and installs the package to /opt/conda/lib/python3.6/site-packages/. This means it will be lost the next time the container starts/user logs in.

I had thought that that directory was write protected so that the only way to install a new package would be pip install --user there which installs it in the user's home directory. This will survive logouts etc.

Seems like a bug to me that users can install stuff in a location that is ephemeral. What do you think?

from hub-ops.

lwasser avatar lwasser commented on August 13, 2024

never followed up on this but... i agree this is not ideal if users can install things that in turn go away. is there a way for students to install tools so that they remain available to them? honestly i guess do we even want that for a class? perhaps not??

from hub-ops.

lwasser avatar lwasser commented on August 13, 2024

Oh!! i haven't tried that @betatim !! i will give it a shot this week however. I see where you are going with that approach. Do you always install using the --user flag? IE do you think it is more robust??

from hub-ops.

lwasser avatar lwasser commented on August 13, 2024

@jlpalomino can you test this out this week please? essentially do this

  1. login to the hub
  2. install something -- i guess you could try pip but ideally there is a --user flag for conda forge that we can use! see if that install works - test importing the library.
  3. then login and quit from the hub.
  4. then login again -- is that tool still there??

let us know what you discover. if this works we might want to update the docs!!

from hub-ops.

betatim avatar betatim commented on August 13, 2024

do you think it is more robust?

I don't think it is more robust but it fixes this particular problem I think :)

Do you always install using the --user flag

No because normally I am not "imprisoned" in a docker container but on my laptop where you can edit stuff outside your home directory and the changes aren't lost when you logout and back in. The fact that everything outside /home/jovyan (the user's home directory) is reset to a "pristine state" as define by the docker image each time they login is what is at the root of this problem. I think pip install --user was invented way-back-when to get around a similar problem: the directories outside your home directory were owned by root so you couldn't even write to them so the only way to install stuff was to install them i na directory in your home directory.

from hub-ops.

jlpalomino avatar jlpalomino commented on August 13, 2024

@lwasser I've done some research on install options with conda, and according to various links (stackoverflow, conda github repo), there is not an exact equivalent of pip install --user.

The closest option appears to be conda create -p /home/user/env-name followed by conda install -p /user/env-name package-name, which allows you to create a conda environment in a specific location, such as the user's home directory, and then install the desired package in that conda environment.

For testing in the hub, I started yesterday by installing erddapy using conda install -c conda-forge erddapy. Then, I logged in and out many times throughout the day, and each time the package was imported successfully. However, today, the package is not found, so the environment resets after a certain amount of time, but not right away after a logout.

Today I ran pip install --user erddapy (and the import is successful after logging in and out a few times), so I will test tomorrow whether the erddapy package remains in the environment.

from hub-ops.

lwasser avatar lwasser commented on August 13, 2024

thank you @jlpalomino for testing this. it's not a huge deal for our classes but will be a potential challenge if anyone wants to use the hub for projects. then again they can always reinstall things if need be!

from hub-ops.

jlpalomino avatar jlpalomino commented on August 13, 2024

@lwasser Interesting! I can still import erddapy today after using pip install --user erddapy to install this package yesterday,

from hub-ops.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.