Install pyMedphys on MacBook M1

Hello
My name is Pareena. I’m a student of Medical physics in Thailand.

I need some favor about the installation of pyMedphy on MacBook Air (M1). My problem is I think I already installed supported software as recommendations on the website, but it still shows ‘no matches found: pymedpys[user]’ (Image1). I’m not sure which step I did wrong. How can I fix it?

Another question, what is the difference between ‘pymedphys’ and 'pymedphys[user] because the second code can run and show the result differently(image2)?

Thank you in advance
Pareena


@sjswerdloff have you seen this issue on macs?

No, but I only tried installing PyMedPhys without
any subset specified (as part of installation of OnkoDICOM). I will take a look shortly to see if I can replicate.
Installing a variety of packages on M1 is difficult and if they have underlying C++ it’s even worse (broken Cmake instructions)

This was not a problem on Intel based Mac.
I have not done a recent install on Intel based Mac, but circa 0.37, I had gone through almost each permutation of subsets without installation issues

pip install ‘pymedphys[user]’

One needs to quote the package with extras.
I’m not sure if that’s the shell (zsh) or the new version of pip.
(BTW, I used the wrong terminology… the proper term isn’t subset, it is extras, see PEP 508 – Dependency specification for Python Software Packages | peps.python.org )

Speaking of which, the difference between pymedphys and pymedphys[user] is the extra stuff that comes with [user]. pymedphys alone has a modest set of functionality with a modest number of dependencies. For those who need “more”, there will be more dependencies (bigger download, more potential conflicts, etc). the [user] extras covers all of the additional capabilities but not the developer goodies (e.g. tests, and possibly not the documentation, which is accessible over the web anyway). So that’s the best thing for most users. I think there is still a [dicom] extra if someone only wanted the DICOM related features and wanted to avoid other dependencies that one has if one uses [users]. That’s just an example, not a recommendation. For someone who “wants to try using pymedphys”, the [user] extra is the way to go.

However, I ran in to the following when this got going in earnest:

      building 'pymssql._mssql' extension
      creating build/temp.macosx-12.3-arm64-cpython-39
      creating build/temp.macosx-12.3-arm64-cpython-39/src
      creating build/temp.macosx-12.3-arm64-cpython-39/src/pymssql
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Users/stuartswerdloff/.pyenv/versions/3.9.11/include/python3.9 -c src/pymssql/_mssql.c -o build/temp.macosx-12.3-arm64-cpython-39/src/pymssql/_mssql.o -DMSDBLIB
      src/pymssql/_mssql.c:688:10: fatal error: 'sqlfront.h' file not found
      #include "sqlfront.h"
               ^~~~~~~~~~~~
      1 error generated.
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.

and ultimately:

ERROR: Could not build wheels for pymssql, which is required to install pyproject.toml-based projects

Then I followed the instructions I found on stack overflow (naturally :slight_smile: )

including following the instruction to point to the correct versions of freetds and openssl (I don’t know for sure how well openssl 3 will work vs. 1, but I’ll go through a full build of pymedphys on M1 including tests, and that should shake things out. I know enough of pymedphys works for OnkoDICOM to work (pymedphys[dicom]).

 745  brew install freetds
  746  brew install openssl
  747  ls -l /opt/homebrew/Cellar/freetds/1.3.10/lib
  752  ls -l /opt/homebrew/Cellar/openssl@3/3.0.3/lib
  754  export LDFLASGS="-L/opt/homebrew/Cellar/freetds/1.3.10/lib -L /opt/homebrew/Cellar/openssl@3/3.0.3/lib"
  755  export LDFLAGS="-L/opt/homebrew/Cellar/freetds/1.3.10/lib -L /opt/homebrew/Cellar/openssl@3/3.0.3/lib"
  756  export CFLAGS="-I/opt/homebrew/Cellar/freetds/1.3.10/include"
  757  pip install 'pymedphys[user]'

There were some complaints about the click version being incompatible with the flask version.

But…
% pip list | grep pymedphys
pymedphys 0.38.0

YMMV
@Pareena_Pom hopefully the above will help you get pymedphys running.
Good luck with your studies!