diffpy / diffpy.pdfgui

graphical user interface for real space structure refinement to PDF
Other
19 stars 27 forks source link

pdfgui "no module named 'wx' error" for pip installed diffpy.pdfgui==3.1.0rc4 (Apple M1) #200

Open bobleesj opened 2 weeks ago

bobleesj commented 2 weeks ago

As instructed by @sbillinge, I tried the following steps:

> conda deactivate
> mamba create -n pdfgui-test311 python=3.11 
> conda activate pdfgui-test311
> pip install diffpy.pdfgui==3.1.0rc4
> pdfgui

Pip installation works. But, I get the following error when I type pdfgui

imac@imacs-iMac ~ % pdfgui                                   
Traceback (most recent call last):
  File "/Users/imac/miniconda3/envs/pdfgui-test312/bin/pdfgui", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/imac/miniconda3/envs/pdfgui-test312/lib/python3.12/site-packages/diffpy/pdfgui/applications/pdfgui.py", line 118, in main
    import diffpy.pdfgui.gui.main as guimain
  File "/Users/imac/miniconda3/envs/pdfgui-test312/lib/python3.12/site-packages/diffpy/pdfgui/gui/main.py", line 19, in <module>
    import wx
ModuleNotFoundError: No module named 'wx'

I checked that the regular installation procedure worked:

CONDA_SUBDIR=osx-64 conda create -n pdfgui39 python=3.9
conda activate  pdfgui39
conda config --env --set subdir osx-64
conda install -c conda-forge diffpy.pdfgui
pdfgui
Tieqiong commented 2 weeks ago

@bobleesj Thanks. When you pip install the package you would also like to install all the requirements. This is not necessary when installing from Conda-forge because it will automatically install everything for you. In this case wx means the wxpython package which is one of the requirements. A good way to install requirements easily is to cd to the package dir then run Conda install --file requirements/run.txt (depend on what you want to do you might also want to install test.txt or build.txt). I guess you want to test running pdfgui with the latest pdffit2==1.4.4rc1. So after installing all of the requirements you then (or before installing requirements) uninstall the original pdffit2 you get from Conda-forge and then do the pip install. After this run Conda list to check if everything is correct.

bobleesj commented 2 weeks ago

@Tieqiong Thanks for the answer. I cloned the latest main branch from diffpy.pdfgui and then ran Conda install --file requirements/run.txt

I get the following dependency error fonttools >=4.22.0 for Python 3.12 (M1).


LibMambaUnsatisfiableError: Encountered problems while solving:
  - package matplotlib-base-2.1.2-py27h31f9439_1 requires python >=2.7,<2.8.0a0, but none of the providers can be installed

Could not solve for environment specs
The following packages are incompatible
├─ matplotlib-base is installable with the potential options
│  ├─ matplotlib-base [2.1.2|2.2.3|2.2.4|2.2.5] would require
│  │  └─ python >=2.7,<2.8.0a0 , which can be installed;
│  ├─ matplotlib-base [2.1.2|2.2.3|...|3.3.4] would require
│  │  └─ python >=3.6,<3.7.0a0 , which can be installed;
│  ├─ matplotlib-base [2.1.2|2.2.3|...|3.4.3] would require
│  │  └─ python >=3.7,<3.8.0a0 , which can be installed;
│  ├─ matplotlib-base [2.2.4|2.2.5|...|3.4.3] would require
│  │  └─ python >=3.8,<3.9.0a0 , which can be installed;
│  ├─ matplotlib-base [2.2.5|3.3.2|...|3.4.3] would require
│  │  └─ python >=3.9,<3.10.0a0 , which can be installed;
│  ├─ matplotlib-base 3.4.3 would require
│  │  └─ python >=3.10,<3.11.0a0 , which can be installed;
│  └─ matplotlib-base [3.5.0|3.5.1|...|3.9.2] would require
│     └─ fonttools >=4.22.0 , which conflicts with any installable versions previously reported;
└─ pin-1 is not installable because it requires
   └─ python 3.12.* , which conflicts with any installable versions previously reported.

Pins seem to be involved in the conflict. Currently pinned specs:
 - python 3.12.* (labeled as 'pin-1')
``
Tieqiong commented 2 weeks ago

@bobleesj This is very strange, as on my Mac it install fonttools == 4.53.1 for me. Maybe try uninstall it and then install? It could be that you had a older version installed somewhere before?