bwohlberg / sporco

Sparse Optimisation Research Code
http://brendt.wohlberg.net/software/SPORCO/
BSD 3-Clause "New" or "Revised" License
258 stars 37 forks source link

import issue on mac M1 #28

Closed young-oct closed 10 months ago

young-oct commented 2 years ago

This error arises when doing simple import such as from sporco import signal with pycharm

    from __future__ import print_function
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: from __future__ imports must occur at the beginning of the file
bwohlberg commented 2 years ago

Could you check your sporco version? Both the dev version and most recent release have this as the first import statement:

from __future__ import absolute_import, division, print_function

which differs from the import in your error message.

young-oct commented 1 year ago

@bwohlberg Apologies for the late reply. I tried to install sporoco with both pip and conda method. When I installed through pip, I ran into the same issue of Failed to build pyfftw, when I tried to install via conda.

I got an error message as follows:


(complex) youngwang@DF047 CAO_OCT % conda install -c conda-forge sporco
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

  - sporco

Current channels:

  - https://conda.anaconda.org/conda-forge/osx-arm64
  - https://conda.anaconda.org/conda-forge/noarch
  - https://repo.anaconda.com/pkgs/main/osx-arm64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/osx-arm64
  - https://repo.anaconda.com/pkgs/r/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.
bwohlberg commented 10 months ago

Sorry for the very long delay. It looks as if pyfftw is still unsupported on MacOS ARM hardware. It is possible to use sporco without pyfftw, but many of the functions will be slower. The easiest way to install without pyfftw is probably to clone from github, remove pyfftw from the requirements.txt file, and install from source.

young-oct commented 10 months ago

@bwohlberg , don't worry about it! i will give this a try and keep you posted. many thanks

bwohlberg commented 10 months ago

Closing for now. Please respond here if and when you would like to pursue this further.