Enable list packages installed with pip in micromamba
Fix #2059
Awesome!
Maybe naive question, why don't we just use pip freeze or something like that? Is the site-packages method guaranteed to work?
Maybe naive question, why don't we just use
pip freezeor something like that? Is the site-packages method guaranteed to work?
That could be a way too I guess (but then we should be able to get the output of the launched command, is there another method allowing that since reproc::run doesn't?)... Using site-packages method was inspired from the way they do it in conda but less complicated. I haven't fully tested it yet because I was trying to activate a micromamba env within a conda env (using a built micromamba) which doesn't seem to work... A bug or maybe I missed something?
Hmm, actually I think that the way I did it won't do because I considered that pip install pkg passes necessarily through install code in micromamba, which is only the case when we do install from a spec file and pip is mentioned there... So I guess we should use a different method (maybe the pip freeze one if, as I said, there is a way to get the output)...
I kind of understand now the complicated way of conda...
does this also cover micromamba env export?
This PR is still a WIP, but when done the env export should be pretty straightforward I think.
> assert expected_link_packages.issubset(link_packages)
E AssertionError: assert False
E + where False = <built-in method issubset of set object at 0x10a0cb300>({'openssl', 'pip', 'python', 'readline', 'setuptools', 'sqlite', ...})
E + where <built-in method issubset of set object at 0x10a0cb300> = {'python', 'python_abi'}.issubset
is this a MacOS issue?
> assert expected_link_packages.issubset(link_packages) E AssertionError: assert False E + where False = <built-in method issubset of set object at 0x10a0cb300>({'openssl', 'pip', 'python', 'readline', 'setuptools', 'sqlite', ...}) E + where <built-in method issubset of set object at 0x10a0cb300> = {'python', 'python_abi'}.issubsetis this a MacOS issue?
Well it does happen only on the MacOS on CI, but I can't tell for sure if the error is related to this PR or not... (I'll have to investigate more...)
cc @AntoinePrv Thanks :)
@Hind-M, playing around with pip, I found the following good ideas:
pip [...] --path [PrefixData]could be a good idea to make sure we are using the right path (even if the wrong pip, see comment)pip inspectcould be perfect here. It returns a json (therefore safe to parse) with plenty of useful information, in particular thatinstalled[pgk_idx].installer(piporconda) andinstalled[pgk_idx].requested
{
"metadata": {
"metadata_version": "2.1",
"name": "args",
"version": "0.1.0",
"platform": [
"any"
],
"summary": "Command Arguments for Humans.",
"home_page": "https://github.com/kennethreitz/args",
"author": "Kenneth Reitz",
"author_email": "[email protected]",
"license": "BSD",
"classifier": [
"Environment :: Web Environment",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
"Topic :: Software Development :: Libraries :: Python Modules"
],
"description": "\nargs\n~~~~\n\nThis simple module gives you an elegant interface for your command line argumemnts.\n\n\n\n"
},
"metadata_location": "/Users/antoine/.local/share/mamba/envs/mamba-dev/lib/python3.10/site-packages/args-0.1.0.dist-info",
"direct_url": {
"url": "file:///home/conda/feedstock_root/build_artifacts/args_1637347267685/work",
"dir_info": {}
},
"installer": "conda",
"requested": true
},
I think this would be an amazing feature to have Can't wait :)
any updates? imho this is a priority bug because it prevents most people to use micromamba if they can't see any installed pip packages. workaround using conda works but then why use micromamba in the first place? it's main unique selling point is that it's a standalone application which makes it really stand out
I really appreciate y'all's work on this PR, and just wanted to say I still find this to be an important missing feature in my workflow; for now, I install conda in my workflow's environment solely to do conda env export > environment.yml so I can have the pip: section in the output. Looking forward to this being merged eventually!
Superseded by #3565