Hi all!
Pretty new to PyRevit development but very excited to get going! I am exploring CPython and have been stuck for a couple of hours trying to import numpy into my plugin. I have tried a couple of things including
- copying over the contents of site-packages for my normal Python installation into a lib file in the same folder. the lib folder showed up in my path while printing
- setting PYTHONPATH to the location of the site-packages above ^. it looked something like c:\users\me\appdata\local\packages\pythonsoftwarefoundation.python.3.12\localcache\local-packages\python312\site-packages
- creating a virtual env and then pip install’ing numpy into that virtual env. Then appending the location of the virtual env’s site-packages to sys inside of cpython (
sys.path.insert(0, 'path/venv/Lib/site-packages')
). To me, this should definitely work.
Eachtime I got
ImportError : Error importing numpy: you should not try to import numpy from
its source directory; please exit the numpy source tree, and relaunch
your python interpreter from there.
My code is exactly same as in this example except with the extra sys commands.
Really not sure what is going on here, any help is appreciated! Figured I’d create a new thread instead of continuing the conversation in this post. @sanzoghenzo if you have any ideas or resources to point me too, would also be much appreciated thank you!