-
Notifications
You must be signed in to change notification settings - Fork 126
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
Mantid doesn't work with latest setuptools on Windows #33118
Comments
I think this is an issue only for developers where the workbench.exe\workbench-script.pyw and egg-link's are relied upon to access the MantidWorkbench package in the source directories from within build\bin |
The sitecustomize.py mechanism previously set up to handle setuptools>=49.0.0 seems to clash on Windows with a pre-existing sitecustomize.py that lives in C:\mantid\external\src\ThirdParty\lib\python3.8\Lib\site-packages. I think Python only supports a single sitecustomize.py |
So in summary two changes:
With these changes, the only bit that doesn't work is the MantidWorkbench.exe (which is Windows\OSX only) in a developer set up. I've only tested in on Windows but it's not finding the |
Ah I see now. Yes, I believe that Python just does an |
Unfortunately a sitecustomize.py located in I think this is because the path of the workbench startup script supplied to python (ie So my earlier comments about there being a clash when you have 2 sitecustomize.py files need clarifying a bit. This is only a problem when starting up workbench using the PyCharm Run, Debug menu. One way around this is to rely on the .egg-link files to guide the workbench start up exe\script to the python packages in the source code directories (eg qt\applications\workbench) when a developer is running workbench from a build directory. I've made a change to mantidworkbench.cpp (the unit that wraps the error handler around the workbench start up) so that it uses the egg info to find the "entry point" and this seems to work. Maybe I'll create a PR and you can see what I've done? Or if I'm not making any of this clear we could have a chat tomorrow |
Yeah happy to review any pull request. It sounds like something that is heading in a promising direction. |
I've just noticed there's been some quite recent discussion about this problem: This discussion suggests the .egg-link files are being deprecated so maybe my solution isn't going to be very long lasting even if it works for now. These links instead suggest relying on the sitecustomize.py as you suggested. I'll see if I can work out a way of getting the |
This issue has been automatically marked as stale because it has not had activity in 6 months. It will be closed in 7 days if no further activity occurs. |
I think this is still an issue. For example this change was put through in earlier in this (6.5) release cycle to pin setuptools to 47.0.0: |
This issue has been closed automatically. If this still affects you please re-open this issue with a comment or contact us so we can look into resolving it. |
This is still an issue that should be addressed. |
This issue has been automatically marked as stale because it has not had activity in 6 months. It will be closed in 7 days if no further activity occurs. |
This issue has been closed automatically. If this still affects you please re-open this issue with a comment or contact us so we can look into resolving it. |
Think this is still relevant |
This is a blocker for moving to python 3.10 |
I recently updated the Python setuptools package on my Windows laptop by accident and I noticed that workbench and system tests stopped working. I looked into this a bit and came across some issues where support had been added to Mantid for setuptools v49.0.0 or later (eg #32068).
The problem on Windows seems to be that the python version is 3.8 which includes a new importlib.metadata module. This alters the behaviour of the shim (workbench-script.pyw) created by setuptools v49.0.0 or later:
Ubuntu uses python 3.6 so the shim imports pkg_resources instead.
This difference matters because it appears to me that importlib doesn't recognise .egg-link files whereas pkg_resources does. The .egg-link file needs to be read in order to locate the MantidWorkbench package in a developer's source code directory at qt\applications\workbench
Mantid works OK on older versions of setuptools because the shim is different to the one above and always uses pkg_resources
Maybe this isn't A1 priority but I wondered about fixing it because it wasn't v obvious what was going wrong - I just had a dev environment which wouldn't work and failed with a "cannot find _kernel.." error*. Not sure what can be done to fix this though - perhaps there's a way of getting setuptools to create a custom .pyw file somehow. The standard .pyw file seems to be autogenerated when you use the gui_scripts entry point in the qt\applications\workbench\setup.py file.
The text was updated successfully, but these errors were encountered: