Skip to content

Commit

Permalink
Install pip deps from the directory of environment.yml
Browse files Browse the repository at this point in the history
Suppose we have the following dependencies in the environment.yml:

```
dependencies:
  - pip
  - pip:
    - -r requirements.txt
    - -e deps/my_local_package
```

Without this commit, it is impossible to install such dependencies with
micromamba. That is because micromamba was creating its own temporary
requirements.txt file in the /tmp directory and called pip to install them.

For some reason pip resolves `-r` paths as relative to the file that
contains them, but `-e` paths as relative to the current working directory.
It is a known issue in pip: pypa/pip#8765.

So in the case of mamba, pip looks for `/tmp/requirements.txt` and
`directory/of/env/yml/deps/my_local_package` and unless whole project
is thrown right into `/tmp` this installation will fail.

This commit makes it so installing pip deps matches the behavior of conda.
  • Loading branch information
michalsieron committed Jan 21, 2023
1 parent c0f8498 commit 374d8b7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libmamba/src/api/install.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ namespace mamba

const auto& ctx = Context::instance();

TemporaryFile specs;
TemporaryFile specs("mambaf", "", cwd);
{
std::ofstream specs_f = open_ofstream(specs.path());
for (auto& d : deps)
Expand Down

0 comments on commit 374d8b7

Please sign in to comment.