Building PYNE from Source and Adding to venvs

22 views
Skip to first unread message

Rodgers, Alex N

unread,
Dec 18, 2024, 1:54:03 PM12/18/24
to pyne...@googlegroups.com

Hello,

 

What is the correct way to add PYNE to a venv after building from source? I am trying to build to a central location that users can either install to their venv or add to their PYTHONPATH variable.

 

I have successfully built PYNE and installed it to the venv used to build PYNE. However, when building and installing it to a directory using the “--prefix" argument, I cannot use the package. Adding the INSTALL_PATH/lib/python3.11/site-packages to my PYTHONPATH and INSTALL_PATH/bin to my PATH does not work. When trying to use a different venv, all tests fail with an error related to “ModuleNotFoundError: No module named 'pyne.utils'”.

 

I see it looks like there is an egg file being built somewhere along the installation process, but easy_install is deprecated and not included in recent versions of setup tools. Is there a supported way to do this, or can PYNE be built as a whl?

 

I am building PYNE 0.7.8 on SLES15 with Python 3.11.3.

 

Alex Rodgers

Nuclear Engineer II

Radiation Engineering & Analysis

 




This e-mail may contain proprietary information of the sending organization. Any unauthorized or improper disclosure, copying, distribution, or use of the contents of this e-mail and attached document(s) is prohibited. The information contained in this e-mail and attached document(s) is intended only for the personal and private use of the recipient(s) named above. If you have received this communication in error, please notify the sender immediately by email and delete the original e-mail and attached document(s).

Paul Wilson

unread,
Dec 18, 2024, 2:06:19 PM12/18/24
to pyne...@googlegroups.com

Hi Alex,

 

Building PyNE as a whl is definitely on our roadmap, but waiting on some dependency updates.

 

I’m afraid that we don’t collectively have a lot of experience with venv as we generally rely on conda for python environment based management.

 

I wonder if any others can offer any tips?

 

Paul

 

 

-- 
-- ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ --
Paul P.H. Wilson (he/him/his)
Grainger Professor of Nuclear Engineering
Chair, Department of Nuclear Engineering & Engineering Physics
o: 608-263-0807, c: 608-469-9615
paul....@wisc.edu
153 Engineering Research Bldg
1500 Engineering Dr, Madison, WI 53706
Zoom Meeting Room: https://uwmadison.zoom.us/j/6082630807
Zoom Phone Access: +1-929-205-6099, Access code: 6082630807

Computational Nuclear Engineering Research Group

 

 

 

--

---
You received this message because you are subscribed to the Google Groups "PyNE" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyne-dev+u...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pyne-dev/CO6PR05MB7649981117DB3661703CCFF59C052%40CO6PR05MB7649.namprd05.prod.outlook.com.

Ahnaf Tahmid

unread,
Jan 7, 2025, 12:18:01 PMJan 7
to PyNE
Hi Alex,

If you're using venv, a good approach is to set the --prefix argument to your virtual env's root dir during installation. Here’s a quick example:

python -m venv env
source env/bin/activate
python setup.py install --prefix path/to/env


This should make sure PyNE is installed correctly within your virtual env, and activating it will handle PYTHONPATH and PYTHONHOME automatically.

We also have an ongoing PR aimed at improving PyNE's build system with. You can check out the branch here: scikit-build-core branch, and follow the PR progress here: PR #1549.

As Paul mentioned, conda is another solid option. One of its key benefits is better handling of multiple python versions, while venv typically sticks to the system python or a manually installed version.

Hope this helps! Let me know if you run into any more issues.

Best regards,  
Ahnaf Tahmid Chowdhury
Reply all
Reply to author
Forward
0 new messages