pmcx binary extension (_pmcx) is not compiled

11 views
Skip to first unread message

Jason Yang

unread,
Dec 9, 2025, 11:37:13 PM (2 days ago) Dec 9
to mcx-users
Hi Dr. Fang, 

I am trying to run a simple simulation that used to run several months ago. I have updated to the latest versions of pmcx / pmcxcl and now when I run res=pmcx.mcxlab(cfg), i get the following error:

"
     26 cfg['prop']=[[0,0,1,1],[0.005,1,0.01,1.37]]
     28 # run the simulation
---> 29 res=pmcx.mcxlab(cfg)
     31 # analyzing the result
     32 res.keys()

File ~\miniconda3\envs\py310\lib\site-packages\pmcx\utils.py:625, in mcxlab(*args)
    622             args[0]["savedetflag"][detfields == 0] = []
    624 if useopencl == 0:
--> 625     varargout = run(args[0])
    626 else:
    627     try:

UnboundLocalError: local variable 'run' referenced before assignment
"

running pmcxcl also yields a similar error. 
I am currently running python3.10 via anaconda, but also using 3.13 (on anaconda) yields the same results. 

Am i missing a step?

Thanks,
Jason Y. 

Qianqian Fang

unread,
Dec 10, 2025, 11:43:10 AM (yesterday) Dec 10
to mcx-...@googlegroups.com, Jason Yang

hi Jason,

pmcx contains two parts - the core simulation is compiled as a binary module, named _pmcx (built from mcx's C/CUDA-C source codes, providing .run() and .gpuinfo()), and the remaining are utility functions written in pure Python (such as pmcx.detweight(), etc).

the binary module is python version dependent, and only available on platforms where NVIDIA CUDA is supported (Linux, Windows  - it is not supported on MacOS)

you need to tell me what Python version you are using, and the OS - if it is on a Mac, you will have to use pmcxcl instead of pmcx.

all supported Python versions can be found here

https://pypi.org/project/pmcx/#files


Qianqian


On 12/9/25 10:14, Jason Yang wrote:

You don't often get email from pimast...@gmail.com. Learn why this is important

--
You received this message because you are subscribed to the Google Groups "mcx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mcx-users+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/mcx-users/92b52f75-a068-4820-8121-0132da7cc213n%40googlegroups.com.

pimast...@gmail.com

unread,
Dec 10, 2025, 12:00:09 PM (yesterday) Dec 10
to Qianqian Fang, mcx-...@googlegroups.com

Hi Qianqian,

 

Thanks for your response. I actually found the issue.  It seems that sparse-numba is trying to be loaded, but it is not automatically installed by pip – is it missing from requires-dist?. Missing this library was caught by the exception handler which ended up not loading ‘run’ from pmcx(cl) and falsely indicating that _pmcx is not compiled.

 

Is sparse-numba strictly necessary? For reference, sparse-numba is not currently supported by python 3.13.

 

Thanks,

Jason Y.

Qianqian Fang

unread,
Dec 10, 2025, 12:17:15 PM (yesterday) Dec 10
to pimast...@gmail.com, mcx-...@googlegroups.com

hi Jason,

installing sparse-numba is needed for pmmc on Windows, see my previous message

https://groups.google.com/g/mmc-users/c/v7xFZj4tbcw/m/u6dht0c1AQAJ

it only serves for the purpose of providing some .dll functions that are missing on your windows (related to OpenMP). pmmc definitely need those. 

I can't remember why sparse_numba was added in pmcx about 4 months ago, but with a quick test, I don't think it is needed. This is because _pmcx on windows was compiled using visualstudio's cl.exe which has its own OpenMP support, and does not need the .dll provided by sparse-numba.

let me do more tests, likely I will drop this import check in the next version update.

Qianqian

Qianqian Fang

unread,
Dec 10, 2025, 12:57:46 PM (yesterday) Dec 10
to mcx-...@googlegroups.com, pimast...@gmail.com

FYI, I just bumped pmcx's version to 0.6.2 and removed sparse_numba dependency

https://github.com/fangq/mcx/commit/b6b85736848d42d0b66f85a07f48ed0b320622be

please run pip install --upgrade pmcx to use the updated pmcx

pimast...@gmail.com

unread,
6:28 AM (8 hours ago) 6:28 AM
to Qianqian Fang, mcx-...@googlegroups.com

Hi Qianqian,

 

Thanks for the quick replies to this! I have just checked on my end and can confirm that pmcx works as expected now without sparse-numba on python 3.10 on windows.

 

On a separate (minor) note, are there any binaries for pmcxcl for python 3.13? pip install and pypi both suggest that pmcxcl only supports up to python 3.12.

 

Thanks for your help on this!

Reply all
Reply to author
Forward
0 new messages