Skip to content

Commit

Permalink
Fix directory navigations, rellinks etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
agahkarakuzu authored Feb 18, 2024
1 parent 47f08c4 commit 088dccd
Showing 1 changed file with 1 addition and 1,614 deletions.
Loading

7 comments on commit 088dccd

@mathieuboudreau
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@agahkarakuzu I think the directory changes you made (possibly in this commit) to the data made it such that the Colab build (and I'm going to assume, possibly also the repo2docker build) is breaking:

Screenshot 2024-02-20 at 11 26 39 AM

I thought I had setup the repo2data folder format to match the neurolibre requirement for directory structure, do you recall why you changed my old way?

@mathieuboudreau
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eg lines like path_data = os.path.join(os.getenv('HOME'),"data/rf-shimming-7t/ds004906")

are incorrect in Colab, as

Screenshot 2024-02-20 at 11 31 01 AM

So we nee to be careful which or how paths are set for NeuroLibre Binder vs Colab vs Local Binder

@mathieuboudreau
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a curious quirk:

Screenshot 2024-02-20 at 11 33 13 AM

@mathieuboudreau
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

os.getenv() method in Python OS env returns the value of the os environment variable key if it exists otherwise returns the default value.

Ouff, so the default is just /root in Colab because $HOME isn't defined in their container/instance. We'll need to go another way about it then, this is an important quirck to know for both of us I think @agahkarakuzu haha

@mathieuboudreau
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The more I dig, the more this seems to be maybe a very Colab-specific behaviour (which is quite confusing and annoying):

Screenshot 2024-02-20 at 11 43 34 AM

So the best way is likely to just set the home path to /content when you're in Colab, as this is always going to be it by default. I'll continue to look a short amount of time more but so far all the cross-platform ways to get the home path is incorrectly showing /root instead of /content for Colab

@mathieuboudreau
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess some folks on Raspberry Pi's get the same issue, seems like python is switching between using root vs the user when looking for the home folder, https://raspberrypi.stackexchange.com/questions/34216/using-os-path-expanduser-i-am-getting-root-instead-of-home-pi

This could possibly be an issue for Docker containers as well depending on the platform/if users modded it to run as root/user (not sure which one)?

@mathieuboudreau
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After testing a few options, I think I'll have to go the following route:

if notebook=='colab':
  path_data = os.path.join("/content/ds004906")
else:
  path_data = os.path.join(os.getenv('HOME'),"data/rf-shimming-7t/ds004906")

Testing it on colab; will also need to test it on repo2docker locally

Please sign in to comment.