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.

AttributeError: module 'os' has no attribute 'geteuid'

See original GitHub issue

Bug description

Expected behaviour

Expect to produce docker image.

Actual behaviour

Traceback (most recent call last):
  File "c:\appdata\local\continuum\anaconda3\lib\site-packages\traitlets\traitlets.py", line 528, in get
    value = obj._trait_values[self.name]
KeyError: 'user_id'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\appdata\local\continuum\anaconda3\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\appdata\local\continuum\anaconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\AppData\Local\Continuum\anaconda3\Scripts\repo2docker.exe\__main__.py", line 9, in <module>
  File "c:\appdata\local\continuum\anaconda3\lib\site-packages\repo2docker\__main__.py", line 345, in main
    r2d = make_r2d()
  File "c:\appdata\local\continuum\anaconda3\lib\site-packages\repo2docker\__main__.py", line 300, in make_r2d
    if r2d.user_id == 0 and not r2d.dry_run:
  File "c:\appdata\local\continuum\anaconda3\lib\site-packages\traitlets\traitlets.py", line 556, in __get__
    return self.get(obj, cls)
  File "c:\appdata\local\continuum\anaconda3\lib\site-packages\traitlets\traitlets.py", line 535, in get
    value = self._validate(obj, dynamic_default())
  File "c:\appdata\local\continuum\anaconda3\lib\site-packages\repo2docker\app.py", line 206, in _user_id_default
    return os.geteuid()
AttributeError: module 'os' has no attribute 'geteuid'

How to reproduce

  1. On a Windows 10 PC, open the Anaconda Command Prompt
  2. Run repo2docker https://github.com/matthewolckers/fbr2020
  • OS: Windows 10
  • Docker version: 19.03.8,
  • repo2docker version 0.11.0

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
manicscommented, Dec 10, 2020

AFAIK the only reason to make the UID inside the Docker image match the user’s UID is so that if you mount the user’s home directory into the container it’ll be writeable. Is that possible on Windows and if so, how are UIDs mapped, since that might lead to a good solution?

0reactions
ivergaracommented, Dec 27, 2020

I got to move from the original issue by forcing to run with a given GUID in the _user_id_default method.

    @default("user_id")
    def _user_id_default(self):
        """
        Default user_id to current running user.
        """
        if sys.platform == "win32" or not hasattr(os, "geteuid"):
            return 1001
        return os.geteuid()

With this change, the execution then stops working in step 31 when trying to execute install-miniforge.bash.

Step 30/50 : USER root
 ---> Using cache
 ---> 394ba1fe367c
Step 31/50 : RUN TIMEFORMAT='time: %3R' bash -c 'time /tmp/install-miniforge.bash' && rm /tmp/install-miniforge.bash /tmp/environment.yml
 ---> Running in cf91e3dafa9a
bash: /tmp/install-miniforge.bash: Permission denied
time: 0.001

My docker knowledge at this moment doesn’t go too deep as to know how to start digging deeper into this error/issue. Anyone here has a hint on how to progress here to diagnose the problem in an effective way?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python os.geteuid() for windows - Stack Overflow
User id in Windows? I'm not sure getpass is what you want. import getpass getpass.getuser() >>> 'HelloWorld'. But be careful, the function ...
Read more >
Problem with os.getuid() module on Python3 for Windows
DevNet Learning Map: Problem with os.getuid() module on Python3 for Windows ... AttributeError: module 'os' has no attribute 'getuid'.
Read more >
Responder Issues - Google Groups
AttributeError : 'module' object has no attribute 'geteuid' ... It is showing that error because os.geteuid() is not available on windows.
Read more >
'geteuid' windows - python - Daniweb
module ' object has no attribute 'geteuid' windows. There is no "geteuid" in the code you posted. You will have to post the...
Read more >
Python Examples of os.getuid - ProgramCreek.com
You may also want to check out all available functions/classes of the module os , or try the search function . Example #1....
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