Running maturin develop in WSL2 venv fails due to Permission Denied (os error 13)

Bit of a newbie with Rust/WSL2 here. Context: I'm using WSL2. I'm trying to run the command

maturin develop --cargo-extra-args="--release"

in order to build rust code and package it inside a python module for a project. I've installed Rust and also nightly toolchain without a problem as far as I can tell.

When i run the command in a virtual environment, i get the error message "Permission Denied (os error 13) at path foo", followed by some other error messages indicating cause of failure (native library not built through cargo).

I tried to run the same command with sudo but that didn't work either as it said I needed to be in a virtual environment (which i am, but i guess sudo doesn't carry over the fact that I am in a virtual environment in the git cloned branch I am working in? Not sure).

Idk if this additional info is useful but I am using VSCode, working in a git repository that is cloned to a directory in my Ubuntu subsystem.

Here are the instructions from the Readme file in the repository i'm following.

You can then just cd in to this directory and run:


maturin develop --cargo-extra-args="--release"


This commmand will build the rust code for your plateform and package it, alongside the python wrappers, inside a python module and automatically export it in your virtual environment.

Thanks in advance!

I managed to progress further in that now, when running the command, cargo seems to build everything correctly. However, the maturin command specifically fails, due also to a permission os error 13. I got around the original issue by running chown (user):admin folderpath, which meant i could access that particular folder path and everything in it. However, this didn't fix the maturin issue. Here is a screenshot:

Any help on this?

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.