Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permission denied error in Alpine Linux #270

Open
christopherpickering opened this issue Jul 6, 2022 · 2 comments
Open

Permission denied error in Alpine Linux #270

christopherpickering opened this issue Jul 6, 2022 · 2 comments
Labels

Comments

@christopherpickering
Copy link

Hi, Probably the answer is simple :) I'm trying to run in Alpine Linux to install a package and get a permission denied errno 13.

Oddly, some packages install ok, and some have the permission denied. For example if you use this to install the requests module, it works. The python error suggest adding the --user flag, but that doesn't help here.

Here's how to produce it:

# start up docker alpine + node
docker run --rm -it node:18-alpine /bin/sh 

# start a project
mkdir test && cd test && npm init -y && npm i python-shell

# install python and pip
apk add python3
apk add py3-pip

# make a script
cat > index.js<< EOF
const { PythonShell } = require('python-shell');

PythonShell.defaultOptions = {};
const options = {
  mode: 'text',
  args: ['pip', 'install', 'pandas'],
  pythonOptions: ['-u'],
  env: { PYCHARM_HOSTED: 1 },
};

try {
  PythonShell.getVersionSync();

  PythonShell.run('-m', options, function (error, results) {
    if (error) throw error;
    console.log(results.join('\n'));
  });
} catch(e) {
  console.log(e);
  process.exit(1)
}
EOF

# run the script
node ./index.js

You can run python3 -m pip install pandas from the terminal without problem.

I suppose it is doing something in system folder.

Here's the error:

/test # node ./index.js
/test/index.js:15
    if (error) throw error;
               ^

PythonShellError:   ERROR: Error [Errno 13] Permission denied: '' while executing command pip subprocess to install build dependencies
ERROR: Could not install packages due to an OSError: [Errno 13] Permission denied: ''
Consider using the `--user` option or check the permissions.


    at PythonShell.parseError (/test/node_modules/python-shell/index.js:303:21)
    at terminateIfNeeded (/test/node_modules/python-shell/index.js:190:32)
    at ChildProcess.<anonymous> (/test/node_modules/python-shell/index.js:182:13)
    at ChildProcess.emit (node:events:537:28)
    at ChildProcess._handle.onexit (node:internal/child_process:291:12) {
  executable: 'python3',
  options: [ '-u' ],
  script: '-m',
  args: [ 'pip', 'install', 'pandas' ],
  exitCode: 1
}

Node.js v18.4.0

Any ideas are appreciated!

@Almenon
Copy link
Collaborator

Almenon commented Sep 27, 2022

This is very weird... Good find, not sure what's up with this.

Pandas is failing to install even with just python inside that docker image, do you have any other libraries that can be used to reproduce this error?

@christopherpickering
Copy link
Author

@Almenon not offhand, I just picked a couple of the top librarys to test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants