paulscherrerinstitute / pcaspy

Portable Channel Access Server in Python
BSD 3-Clause "New" or "Revised" License
32 stars 24 forks source link

Installing with conda on macOS does not work #93

Open wigging opened 9 months ago

wigging commented 9 months ago

I'm trying to install pcaspy in a conda environment on a MacBook Pro. I created and activated the environment as shown here:

conda create --name pcaspyenv python
conda activate pcaspyenv

In the activated environment I ran the following command to install pcaspy:

conda install -c paulscherrerinstitute pcaspy

Running conda list, the packages installed in the environment are shown below. I noticed the pcaspy version is listed as 0.6 in my conda environment but the version at https://anaconda.org/paulscherrerinstitute/pcaspy is 0.8.

# packages in environment at /opt/miniconda3/envs/pcaspyenv:
#
# Name                    Version                   Build  Channel
bzip2                     1.0.8                h1de35cc_0  
ca-certificates           2023.08.22           hecd8cb5_0  
epics-base                3.14.12.8            h75233e6_5    paulscherrerinstitute
expat                     2.5.0                hcec6c5f_0  
libcxx                    14.0.6               h9765a3e_0  
libffi                    3.4.4                hecd8cb5_0  
ncurses                   6.4                  hcec6c5f_0  
openssl                   3.0.12               hca72f7f_0  
pcaspy                    0.6.0                         0    paulscherrerinstitute
pip                       23.3            py312hecd8cb5_0  
python                    3.12.0               hd58486a_0  
readline                  8.2                  hca72f7f_0  
setuptools                68.0.0          py312hecd8cb5_0  
sqlite                    3.41.2               h6c40b1e_0  
tk                        8.6.12               h5d9f67b_0  
tzdata                    2023c                h04d1e81_0  
wheel                     0.41.2          py312hecd8cb5_0  
xz                        5.4.2                h6c40b1e_0  
zlib                      1.2.13               h4dc903c_0  

In the conda environment, when I try to import pcaspy in a Python session, I get a module not found error as shown here:

>>> import pcaspy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pcaspy' 

Is there something else needed to install this package with conda?

xiaoqiangwang commented 9 months ago

One of my colleagues had the same issue on one of his Linux miniconda installation, but strangely not on the other. I also had similar issue when installing another local package.

conda-build captures some dependencies during build, e.g. Python ABI, numpy. I used the conga-forge docker image to do CI/CD. Maybe you can try the miniforge if it can resolve the version correctly, https://github.com/conda-forge/miniforge.

Another workaround I tried and worked, is to download the package and install it manually.

wigging commented 9 months ago

I would suggest removing the conda instructions or at least label the approach as experimental because it obviously doesn't work for everyone.

wigging commented 9 months ago

I noticed the last workflow failed due to the macOS conda build but the log is no longer available. https://github.com/paulscherrerinstitute/pcaspy/actions/runs/5761415742

xiaoqiangwang commented 5 months ago

I made a new release 0.8.1 which have conda packages for Python 2.7, 3.5-12. The doc explains the limited Python version support f596a60.

The reason for conda picking 0.6.0 is that 0.6.0 conda packages were built in an early stage without pinning the Python version. Now I removed this release from paulscherrerinstitute conda channel. So in the future if a package cannot be found for a specific Python version, it should just raise an error.