Skip to content Skip to sidebar Skip to footer

Have To Keep Reinstalling Python Modules (eclipse Che)?

For my Eclipse Che project, I have to reinstall my python modules every time I load the workspace (blegh). Is there a way to install the modules my team needs to a global folder so

Solution 1:

Alternatively you can build your workspace from a stack based on a Dockerfile recipe:

  1. First, write down all your installation commands that you execute in Eclipse Che terminal when customising your workspace

  2. Next, create a new Dockerfile based on the one you are currently using

    2.1. find the Dockerfile your current workspace is based on from recipes (e.g. for default Python stack it would be this one)

    2.2. modify that file by adding your installation commands from previous step before the last line (EXPOSE 8080) like this: RUN sudo -H pip install flask && sudo -H pip install pandas etc...

  3. In Eclipse Che create a new custom stack based on your Dockerfile

    3.1. Click Stacks on the left (below Workspaces) and click “Add Stack”

    3.2. In “Build stack from recipe” dialog select Dockerfile tab and paste there the content of your modified Dockerfile

    3.3. Click OK => new page opens where you can further customise your stack

    3.4. Edit the name and description, then click NEW-MACHINE to set the memory size as you like then click SAVE (right upper corner)

    3.5. Click again NEW-MACHINE to add some essential Agents: “Workspace API”, “Terminal”, “Exec” and other language servers that you need (e.g. “Python language server”)

    3.6 You can customise your stack further by adding environment vars or servers etc…

  4. Hit SAVE and then TEST to test your stack

  5. On the new dialog that opens you can specify some default project to be added than click “Test Workspace”

  6. If workspace will build successfully your will see below message in green “Your workspace is ready to be used” and the stack will be added to the Stacks. Also your new-machine and Terminal will be opened below

  7. Now close “Testing Stack”, go to Workspaces or Dashboard and create a new Workspace

  8. Your newly created stack should be visible there under stacks so you can select it now and build your workspace based on that

Solution 2:

You can also declare a volume for your workspace where python modules will be persisted.

From the Che documentation:

You can add volumes either by using the User Dashboard or by updating the machine configuration. The following is an example of the configuration file:

"volumes":{"myvolume":{"path":"/absolute/path/in/workspace"}}

Solution 3:

If I understand you question correctly, the best approach would be to build new docker image (based on the one you are using now) with the modules pre-installed and use that image for workspace instead of the default one.

Post a Comment for "Have To Keep Reinstalling Python Modules (eclipse Che)?"