-
Notifications
You must be signed in to change notification settings - Fork 2
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
Refactor to use the windows installer when creating a base environment #145
Refactor to use the windows installer when creating a base environment #145
Conversation
…of embedded packages, and removed most versions from the python version enum. Utilise the installer to remove the environment, and allowed multiplt versions of python to be installed in the python toolkit folder
…utable) to CustomData within the log message.
@BHoMBot check versioning |
@Tom-Kingstone to confirm, the following actions are now queued:
|
@BHoMBot check versioning |
@Tom-Kingstone to confirm, the following actions are now queued:
|
@BHoMBot check versioning |
@Tom-Kingstone to confirm, the following actions are now queued:
There are 1 requests in the queue ahead of you. |
@BHoMBot check versioning |
@Tom-Kingstone to confirm, the following actions are now queued:
|
@BHoMBot check versioning |
@Tom-Kingstone to confirm, the following actions are now queued:
There are 11 requests in the queue ahead of you. |
@jamesramsden-bh suggested that the error should also display which base environments are currently installed (if any) as well as clearly stating that the one requested isn't installed. |
…uired base version if it doesn't exist and leaves a note to say this.
@BHoMBot check installer |
@Tom-Kingstone to confirm, the following actions are now queued:
|
@BHoMBot check installer -force |
@Tom-Kingstone to confirm, the following actions are now queued:
|
The check |
@BHoMBot check installer |
@Tom-Kingstone to confirm, the following actions are now queued:
|
@BHoMBot check required |
@Tom-Kingstone to confirm, the following actions are now queued:
|
@BHoMBot check required |
@Tom-Kingstone to confirm, the following actions are now queued:
There are 22 requests in the queue ahead of you. |
The check |
@BHoMBot check installer |
@Tom-Kingstone to confirm, the following actions are now queued:
|
@Tom-Kingstone to confirm, the following actions are now queued:
There are 13 requests in the queue ahead of you. |
The check |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All functionality works as expected. Jupyter still works and registers venvs correctly too 😄
I have one bit of a feedback though. I understand why we might want to expose different versions to the virtual environments, but for the root environment I think we should hide that option. I tried installing another "BasePythonEnvironment" using a different version and got an error at the very end (trace at the bottom of this message). I think it would be safer to just set the version of the BaseEnvironment behind the scenes and force users to use a specific version to save there being multiple "bases" and some confusion about why this error is happening. This is not a typical install location, nor typical behaviour of a user, so I approve this PR as nothing bad actually happens if you actually install two "Base" environments.
Obtaining file:///C:/ProgramData/BHoM/Extensions/PythonCode/Python_Toolkit
Installing build dependencies ... done
Checking if build backend supports build_editable ... done
Getting requirements to build editable ... error
[process exited with code 1 (0x00000001)]
You can now close this terminal with Ctrl+D, or press Enter to restart.
Obtaining file:///C:/ProgramData/BHoM/Extensions/PythonCode/Python_Toolkit
Installing build dependencies ... done
Checking if build backend supports build_editable ... done
Getting requirements to build editable ... error
error: subprocess-exited-with-error
× Getting requirements to build editable did not run successfully.
│ exit code: 1
╰─> [23 lines of output]
Traceback (most recent call last):
File "C:\ProgramData\BHoM\Extensions\PythonEnvironments\Python_Toolkit\v3_11\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
main()
File "C:\ProgramData\BHoM\Extensions\PythonEnvironments\Python_Toolkit\v3_11\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\ProgramData\BHoM\Extensions\PythonEnvironments\Python_Toolkit\v3_11\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 132, in get_requires_for_build_editable
return hook(config_settings)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tgerrish\AppData\Local\Temp\pip-build-env-91r7q8ug\overlay\Lib\site-packages\setuptools\build_meta.py", line 482, in get_requires_for_build_editable
return self.get_requires_for_build_wheel(config_settings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tgerrish\AppData\Local\Temp\pip-build-env-91r7q8ug\overlay\Lib\site-packages\setuptools\build_meta.py", line 333, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=[])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\tgerrish\AppData\Local\Temp\pip-build-env-91r7q8ug\overlay\Lib\site-packages\setuptools\build_meta.py", line 303, in _get_build_requires
self.run_setup()
File "C:\Users\tgerrish\AppData\Local\Temp\pip-build-env-91r7q8ug\overlay\Lib\site-packages\setuptools\build_meta.py", line 521, in run_setup
super().run_setup(setup_script=setup_script)
File "C:\Users\tgerrish\AppData\Local\Temp\pip-build-env-91r7q8ug\overlay\Lib\site-packages\setuptools\build_meta.py", line 319, in run_setup
exec(code, locals())
File "<string>", line 4, in <module>
ModuleNotFoundError: No module named 'win32api'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build editable did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
[notice] A new release of pip is available: 23.1.2 -> 24.3.1
[notice] To update, run: C:\ProgramData\BHoM\Extensions\PythonEnvironments\Python_Toolkit\v3_11\python.exe -m pip install --upgrade pip
[process exited with code 1 (0x00000001)]
You can now close this terminal with Ctrl+D, or press Enter to restart.
@BHoMBot check ready-to-merge |
@Tom-Kingstone to confirm, the following actions are now queued:
|
NOTE: Depends on
Issues addressed by this PR
Closes #142
The changes in this PR necessitate changes to the following downstream repositories:
Refactor of very core methods, so this PR requires extensive testing, with any python based unit tests and the beta testing procedures.
Updated the base python environment logic to use the windows installer instead of embedded packages (which allows tkinter and other similar libraries to be included), and updated the Remove methods respectively to use the installer to remove the environment (as the windows installer modifies the registry to keep track of the version).
Updated relevant enums and dictionaries to only allow the most recent specific version of each minor python version, as the windows installer does not support having more than one specific version downloaded at the same time.
Move the bhom analytics logger from LadybugTools_Toolkit to Python_Toolkit (as this is where it should be to be accessible to all python based toolkits)
Test files
Use the beta test procedure and any supporting unit tests for this repo and any downstream repositories
Changelog
Additional comments
When testing, make sure that if you wish to remove an environment, use the methods that remove the environments rather than manually deleting the folder, as removing the folder will not update any registry keys and therefore make it impossible to install that version of python again (this is a limitation of the windows installer). If you accidentally do this, contact me for help to resolve the issue.