Giter Club home page Giter Club logo

Comments (30)

woutdenolf avatar woutdenolf commented on July 28, 2024 1

Instead of doing custom things, maybe we can use a more standard way to do fortran bindings like this (see docs)

from shadow3.

srio avatar srio commented on July 28, 2024 1

Thanks to all for your useful remarks.
Yes, I agree that shadow3 needs an update. The pip installable version is too old. Right now I compile the devel-gfortran branch that contains changes suggested by @tshchoonj to work with new versions of gfortran. I compiled it using conda and python3.8 but I do not remember the numpy version I used. I will look into your comments and try to fix these issues soon. If you get something working or suggest some modifications in the setup, I would appreciate. Thanks a lot, M

from shadow3.

srio avatar srio commented on July 28, 2024 1

Thanks a lot Maksim for your help. It looks brilliant. I will look into that as soon as possible. Indeed, it is very good to have it in conda, and your help is very appreciated as I am completely ignorant in conda packaging. I fully agree to have a shared future feedstock with full functionality.
Did you use the devel-gfortran branch ?

from shadow3.

srio avatar srio commented on July 28, 2024 1

Hi @mrakitin. We have been working on that and we have a version pretty much ready. It is the devel-gfortran-yb66 branch. Please use this branch that contains the most updated version (not yet merged with master) and wheels to be used in oasys.

from shadow3.

srio avatar srio commented on July 28, 2024 1

Dear Maksim,

yes, I managed to build the windows version using the recipe that I summarized in the setup.py and I copy here:

# Notes creating windows wheels:
#
# cd src\windows_gfortran
# compile_fortran.bat
# cd ..\..
# python setup.py build --compiler=cygwin
# python setup.com bdist_wheel
# rename dist\...whl to .zip, open it and add the linshadow3.dll and libshadow3c.dll in the Shadow directory. Rename back to .whl

Note that I used the gcc and gfortran compilers! It is possible to compile it with visual studio including the intel-fortran compiler. However, I noticed some crashes and I want to keep the distributed version created with gnu compilers.

Can I test your created conda packages? When can I find them?

We found a problem in the linux version (not in windows and mac), where the option to use a surface mesh does not work. I am looking at that.

regards, M

from shadow3.

woutdenolf avatar woutdenolf commented on July 28, 2024

When removing the NullCommand

cmdclass={
        'build_clib': BuildClib,
        #'build_src': NullCommand,
    },

the following exception occurs

Traceback (most recent call last):
  File "setup.py", line 106, in <module>
    setup(
  File "/users/denolf/virtualenvs/oasys1/ubuntu_20_04/lib/python3.8/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/users/denolf/virtualenvs/oasys1/ubuntu_20_04/lib/python3.8/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/users/denolf/virtualenvs/oasys1/ubuntu_20_04/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/users/denolf/virtualenvs/oasys1/ubuntu_20_04/lib/python3.8/distutils/command/build.py", line 135, in run
    self.run_command(cmd_name)
  File "/users/denolf/virtualenvs/oasys1/ubuntu_20_04/lib/python3.8/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/users/denolf/virtualenvs/oasys1/ubuntu_20_04/lib/python3.8/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/users/denolf/virtualenvs/oasys1/ubuntu_20_04/lib/python3.8/site-packages/numpy/distutils/command/build_clib.py", line 88, in run
    if not self.libraries:
  File "/users/denolf/virtualenvs/oasys1/ubuntu_20_04/lib/python3.8/distutils/cmd.py", line 103, in __getattr__
    raise AttributeError(attr)
AttributeError: libraries

from shadow3.

woutdenolf avatar woutdenolf commented on July 28, 2024

@srio @lucarebuffi Any suggestions? It's for testing this issue: silx-kit/silx#3454

from shadow3.

srio avatar srio commented on July 28, 2024

Hello,
dont' try to recompile everything...
Oasys is installed in NICE, just enter "oasys"
If you want to install in another machine, follow https://www.aps.anl.gov/Science/Scientific-Software/OASYS

The original question on silx is not specfic to oasys/shadowOui but all apps using ImageView, as the behavoiur of the line profile changed a lot.

Many thanks, Manuel

from shadow3.

t20100 avatar t20100 commented on July 28, 2024

@woutdenolf silx-kit/silx#3454 can be reproduced without OASYS, see on the issue.

from shadow3.

woutdenolf avatar woutdenolf commented on July 28, 2024

I can build everything under python 3.7.8.

So not urgent but you'll have to fix this at some point I suppose.

from shadow3.

AbbyGi avatar AbbyGi commented on July 28, 2024

I'm trying to install this on my Mac and I'm encountering a similar issue.

I brew installed gfortran and I'm trying to get version 18.5.30 from PyPi.

Mac version 11.0.1
numpy version 1.20.3
python version 3.7.10

from shadow3.

mrakitin avatar mrakitin commented on July 28, 2024

Hi @woutdenolf, @srio, we were working with @AbbyGi on the compilation of the package. The problem is actually with the numpy.distutils API, changed in the latest versions, so that the missing attribute build_src causes the installation issue. A workaround I've found was to use numpy 1.16, with that version the installation went well. I think the Shadow3 installer should tae into account the changed API in the latest numpy versions.

from shadow3.

mrakitin avatar mrakitin commented on July 28, 2024

Hello @srio, thanks for the quick response! I created a conda feedstock to build the conda package for Shadow3. Here is the feedstock: https://github.com/nsls-ii-forge/shadow3-feedstock (check the meta.yaml for the details of the build and run dependencies). The resulting package is available from https://anaconda.org/nsls2forge/shadow3 (installable with conda install -c nsls2forge shadow3). I used the latest released version at PyPI as a source. Probably worth releasing an up-to-date version, so that can be built with conda. For the NumPy version, I used v1.16 for the packaging step, but the run dependency can be newer.

The longer-term plan is to port that feedstock to conda-forge, so it can be more widely used. I invite you to co-maintain that future feedstock after our team handles the initial feedstock creation.

A side note: the advantage of using conda is that the "heavy" dependencies like xraylib can be installed with no pain of compilation.

from shadow3.

mrakitin avatar mrakitin commented on July 28, 2024

Thanks, Manuel! I haven't tried packaging from that branch. The feedstocks are generally using the tagged versions from GitHub, or releases from PyPI (source distributions, .tar.gz files, not wheels). So the conda version is based on https://files.pythonhosted.org/packages/ee/4d/b506675348eac8b4a7f48dec9e2a9881cded37856a9b4bee618ca82051ca/shadow3-18.5.30.tar.gz from https://pypi.org/project/shadow3/18.5.30/#files.

I can try to package the current version from devel-gfortran in a separate branch to see how it goes.

from shadow3.

mrakitin avatar mrakitin commented on July 28, 2024

@srio, I can confirm that the version from the devel-gfortran branch builds successfully. See nsls-ii-forge/shadow3-feedstock#3 for the updates to the feedstock, and the corresponding build logs. I guess the next step would be to upload a new version to PyPI based on that branch, and we can build the corresponding conda package.

from shadow3.

lucarebuffi avatar lucarebuffi commented on July 28, 2024

As a note, I successfully installed OASYS + Shadow + SRW in python3.8 on a Mac by using numpy 1.18 and fabio 0.11

from shadow3.

CFGrote avatar CFGrote commented on July 28, 2024

I built shadow3 in devel-gfortran following the installation notes in README.md. numpy is v. 1.19.1.However, importing in python (3.9) failed:

>>> from Shadow import *
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "shadow3/Shadow/__init__.py", line 8, in <module>
    from Shadow.ShadowLibExtensions import OE, Source, Beam, CompoundOE, IdealLensOE
  File "shadow3/Shadow/ShadowLibExtensions.py", line 11, in <module>
    import Shadow.ShadowLib as ShadowLib
ImportError: libgfortran.so.4: cannot open shared object file: No such file or directory

Trying to install libgfortran4 from conda leads to multiple inconsistencies.

Any suggestion?

from shadow3.

srio avatar srio commented on July 28, 2024

My suggestion is to use python 3.7, the version used in Oasys. We are working in supporting python ? 3.7 but still there are problems, with shadow and other Oasys dependencies. Sorry!

from shadow3.

robnagler avatar robnagler commented on July 28, 2024

@CFGrote the particular error is due to the version of Fortran, not Python. We haven't been able to build Shadow with gfortran8+, but you can download the binary (pip install) and build libgfortran.so.4 by building gfortran 7.5.

We tried the gfortran8-fixes PR, but it still was getting errors so we rolled back to the above solution.

from shadow3.

CFGrote avatar CFGrote commented on July 28, 2024

Thanks, I managed to compile with gfortran-7. I then ran some tests in tests/. They seem to go through but I get a

Fortran runtime error: Array rank of PUT is not 1.

at the end of each test log.

from shadow3.

robnagler avatar robnagler commented on July 28, 2024

@CFGrote We don't recompile shadow with gfortran7. Instead we build gfortran7, and just take the libgfortran.so.4 from the compile and install it. The compiler on the system is gfortran 10.3.1. However, we pip install shadow3 as a wheel.

from shadow3.

mrakitin avatar mrakitin commented on July 28, 2024

Hi @srio, I would like to follow up on the release based on the devel-gfortran branch discussed above. Do you plan to make the release soon? Thanks!

from shadow3.

mrakitin avatar mrakitin commented on July 28, 2024

Hi Manuel / @srio, thanks for the update! I've tried building off that branch with the latest gfortran 10.3, and it worked OK for Linux and macOS: conda-forge/shadow3-feedstock#6. I am currently excluding the Windows builds due to the failures in the past, but now the package may be ready for Windows. Is it? Are there special instructions on how to build Shadow3 for Windows?

The conda-forge rules encourage using the released artifacts. Do you plan to tag a new version and push it to PyPI soon? I can then update that PR, and build the released version for conda-forge. Thanks!

from shadow3.

mrakitin avatar mrakitin commented on July 28, 2024

Thank you for the updates, @srio! I created a dev branch in the conda-forge feedstock, that can be used to build development versions for testing: https://github.com/conda-forge/shadow3-feedstock/tree/dev. The artifacts are uploaded to https://anaconda.org/conda-forge/shadow3.

The package can be installed as follows:

$ conda install -c conda-forge/label/shadow3_dev shadow3

(Linux/OSX builds only, no Windows yet)

from shadow3.

srio avatar srio commented on July 28, 2024

Most (if not all) of these problems should be fixed in the new release 22.8.20.
@mrakitin: would you please update your conda installers for this version? It should be stable for a while...

from shadow3.

mrakitin avatar mrakitin commented on July 28, 2024

@srio, thanks a lot for the update! This version was built automatically yesterday via conda-forge/shadow3-feedstock#9. It's available in the conda-forge channel now:
image

from shadow3.

mrakitin avatar mrakitin commented on July 28, 2024

Two questions I have at the moment:

  1. I am building it with gfortran v7. Does the build support newer versions? I can try it, but I wonder if you tested it with the newer versions.
  2. What's the state of the Windows builds? I am currently skipping them in the conda feedstock.

from shadow3.

srio avatar srio commented on July 28, 2024

I am building it with gfortran v7. Does the build support newer versions? I can try it, but I wonder if you tested it with the newer versions.

No problem with newer versions.

What's the state of the Windows builds? I am currently skipping them in the conda feedstock.

I created all wheels for windows. I used mingw64 compilers (gcc and gfortran) and python from python.org for creating the wheels, but it also works with miniconda. The wheels created with python.org work well with python from miniconda. The only problem I had is when I installed cygwin or mingw in conda: I recommend not to do it, and use mingw64 installed externally.
Have a look at the specific comments for windows in setup.py.

Thanks for this!

from shadow3.

mrakitin avatar mrakitin commented on July 28, 2024

@srio, I updated the feedstock back in August, and the 2022.8.24 version was built with the latest compilers from the conda-forge toolchain (conda-forge/shadow3-feedstock#10 and conda-forge/shadow3-feedstock#12). With these updates, it's compatible with scipy 1.7+ (previously due to the gfortran 4 restriction newer versions of scipy were conflicting with the shadow3 package).

I tried experimenting with Windows builds but excluded them, as there were failures, and I did not have the bandwidth to fix them for that platform. If there are volunteers, they are welcome to help.

from shadow3.

srio avatar srio commented on July 28, 2024

Thanks Maksim.

In windows I built it in my PC. We are on the way of testing it in other machines to track all dependencies. On the waiting list!

Rgds, M

from shadow3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.