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

Add Python version of openstudio gem_list in OpenStudio Help #5249

Closed
DavidGoldwasser opened this issue Sep 5, 2024 · 3 comments · Fixed by #5301
Closed

Add Python version of openstudio gem_list in OpenStudio Help #5249

DavidGoldwasser opened this issue Sep 5, 2024 · 3 comments · Fixed by #5301
Assignees
Labels
Enhancement Request Triage Issue needs to be assessed and labeled, further information on reported might be needed

Comments

@DavidGoldwasser
Copy link
Collaborator

Enhancement Request

Detailed Description

Possible Implementation

@DavidGoldwasser DavidGoldwasser added Enhancement Request Triage Issue needs to be assessed and labeled, further information on reported might be needed labels Sep 5, 2024
@mdahlhausen mdahlhausen changed the title Add Python version of openstuido gem_list in OpenStudio Help Add Python version of openstudio gem_list in OpenStudio Help Sep 10, 2024
@jmarrec
Copy link
Collaborator

jmarrec commented Nov 4, 2024

For a workaround (and possible C++ implementation)

openstudio -c 'help("modules")'

@jmarrec
Copy link
Collaborator

jmarrec commented Nov 4, 2024

Even better, with python 3.12 only

$os_build_rel/Products/openstudio -c 'import importlib.metadata; mods = sorted([f"{x.name}=={x.version}" for x in importlib.metadata.distributions()]); [print(x) for x in mods]'

or

$os_build_rel/Products/openstudio -c 'from pip._internal.operations.freeze import freeze; [print(x) for x in freeze()]'

@jmarrec
Copy link
Collaborator

jmarrec commented Nov 7, 2024

Wow, the python engine is actually picking up my python virtualenv. @kbenne bringing this to your attention.

(py312)(3.2.2)julien@cli (develop *>)$ $os_build_rel/Products/openstudio -c 'import sys; [print(x) for x in sys.path]'
/home/julien/Software/Others/OS-build-release/Products/python
/home/julien/Software/Others/OS-build-release/Products
/home/julien/Software/Others/OS-build-release/EnergyPlus-24.2.0-94a887817b-Linux-Ubuntu24.04-x86_64/python_lib/lib-dynload
/home/julien/Software/Others/OS-build-release/EnergyPlus-24.2.0-94a887817b-Linux-Ubuntu24.04-x86_64/python_lib
+/home/julien/Virtualenvs/py312/lib/python3.12/site-packages

# or env -i $os_build...
(py312)(3.2.2)julien@cli (develop *>)$ PATH= $os_build_rel/Products/openstudio -c 'import sys; [print(x) for x in sys.path]'
/home/julien/Software/Others/OS-build-release/Products/python
/home/julien/Software/Others/OS-build-release/Products
/home/julien/Software/Others/OS-build-release/EnergyPlus-24.2.0-94a887817b-Linux-Ubuntu24.04-x86_64/python_lib/lib-dynload
/home/julien/Software/Others/OS-build-release/EnergyPlus-24.2.0-94a887817b-Linux-Ubuntu24.04-x86_64/python_lib
-

I noticed this because the above commands seem to add some modules that were definitely not in the E+ python_lib.

And then I tried:

$ env -i $os_build_rel/Products/openstudio -c 'from pip._internal.operations.freeze import freeze; [print(x) for x in freeze()]'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'pip'
terminate called after throwing an instance of 'std::runtime_error'
  what():  Error executing Python code
Aborted (core dumped)

This works

$ env -i $os_build_rel/Products/openstudio -c 'import importlib.metadata; mods = sorted([f"{x.name}=={x.version}" for x in importlib.metadata.distributions()]); [print(x) for x in mods]'
Jinja2==3.1.4
MarkupSafe==2.1.5
MarkupSafe==3.0.0
PLAN-Tools==0.7
colour==0.1.5
coverage==7.6.1
energyplus-launch==3.7.2
iniconfig==2.0.0
numpy==2.0.2
packaging==24.1
pandas==2.2.3
pluggy==1.5.0
pytest-cov==5.0.0
pytest==8.3.3
python-dateutil==2.9.0.post0
pytz==2024.2
six==1.16.0
tkmacosx==1.0.5
tzdata==2024.2

jmarrec added a commit that referenced this issue Nov 12, 2024
@kbenne kbenne closed this as completed in 6d75a7c Nov 13, 2024
kbenne added a commit that referenced this issue Nov 13, 2024
Fix #5249 - Implement a CLI `pip_list` subcommand similar to the ruby `gem_list` one
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Request Triage Issue needs to be assessed and labeled, further information on reported might be needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants