tomoyanonymous / homebrew-flatcam

Unofficial homebrew formula to install flatcam(http://flatcam.org) on macOS
23 stars 8 forks source link

Failing to build #1

Closed julianrendell closed 6 years ago

julianrendell commented 6 years ago

Hi - thanks for creating this Tap!

Unfortunately it is failing to install for me:

Command "/usr/local/Cellar/flatcam/8.5.0/libexec/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-req-build-bidbi0yt/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/tmp/pip-record-rsc1uqbw/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/Cellar/flatcam/8.5.0/libexec/bin/../include/site/python3.7/matplotlib" failed with error code 1 in /private/tmp/pip-req-build-bidbi0yt/
Exception information:
Traceback (most recent call last):
  File "/usr/local/Cellar/flatcam/8.5.0/libexec/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 143, in main
    status = self.run(options, args)
  File "/usr/local/Cellar/flatcam/8.5.0/libexec/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 366, in run
    use_user_site=options.use_user_site,
  File "/usr/local/Cellar/flatcam/8.5.0/libexec/lib/python3.7/site-packages/pip/_internal/req/__init__.py", line 49, in install_given_reqs
    **kwargs
  File "/usr/local/Cellar/flatcam/8.5.0/libexec/lib/python3.7/site-packages/pip/_internal/req/req_install.py", line 791, in install
    spinner=spinner,
  File "/usr/local/Cellar/flatcam/8.5.0/libexec/lib/python3.7/site-packages/pip/_internal/utils/misc.py", line 705, in call_subprocess
    % (command_desc, proc.returncode, cwd))
pip._internal.exceptions.InstallationError: Command "/usr/local/Cellar/flatcam/8.5.0/libexec/bin/python3.7 -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-req-build-bidbi0yt/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/tmp/pip-record-rsc1uqbw/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/Cellar/flatcam/8.5.0/libexec/bin/../include/site/python3.7/matplotlib" failed with error code 1 in /private/tmp/pip-req-build-bidbi0yt/

Also, seeing the following warnings:

Warning: Use cartr/qt4/qt-legacy-formula instead of deprecated qt
Warning: Use cartr/qt4/pyside@1.2 instead of deprecated pyside
tomoyanonymous commented 6 years ago

Thanks for reporting, can you tell me your environment(a version of OS, Xcode, machine)? Because I still have tested only on Xcode9, high sierra on MBP mid 2012. The error seems to fail to install matplotlib. The warnings are not wrong because it uses old pyqt as described in readme! I'll figure out

julianrendell commented 6 years ago

Hi - thanks for the quick reply!

First note: I only have a vague (and out of date) idea of the internals of home-brew and taps.

Re the warnings- I think home-brew changed some things, and asked "legacy" brews to rename themselves. I've forked your repo and made a quick change that seems to get rid of the warnings. Here's the pull request: #2

Building from my tap just finished; matplot lib still fails to build.

Versions for my environment:

Mojave 10.14.1, Xcode 10.1.

I've just tweaked my fork to use latest matplotlib... will report back...

julianrendell commented 6 years ago

Matplotlib built 👍 numpy 1.14 failed 👎

Going to rinse and repeat version updates...

julianrendell commented 6 years ago

Updated versions of all dependencies, and pull request.

Everything built this time, but Flatcam fails to start; can't find PyQt4.

However, I'm guessing part of this is due to Anaconda; it's put it's version of Python first in my path.

Currently cleaning and rebuilding everything.

But the /usr/local/bin/flatcam link pointed to a python script that doesn't look to activate the virtual environment.

Is there an extra step needed before running to activate the right virtual env?

I'm removing all the PyQt4 dependencies, updating/cleaning home-brew, and will rebuild flatcam from scratch with out the Anaconda version of python on the path.

Will report back.

julianrendell commented 6 years ago

Latest update to pull request:

Flatcam still doesn't start, but it looks like it's due to setup.py having some typos/missing files; some of Flatcam's files are not ending up in /usr/local/Cellar/flatcam/8.5.0/libexec/lib/python3.7/site-packages

My next thing to try, and I suspect it will work, is to download the source to flatcam elsewhere and copy across *.py to the above location.

julianrendell commented 6 years ago

Final fix to at least get it running:

git clone https://bitbucket.org/jpcgt/flatcam

cd flatcam

cp *.py /usr/local/Cellar/flatcam/8.5.0/libexec/lib/python3.7/site-packages

cp -R share /usr/local/Cellar/flatcam/8.5.0/libexec/lib/python3.7/site-packages

The final cp -R is needed to get the toolbar icons to appear.

This brew does cause them to be copied to /usr/local/Cellar/flatcam/8.5.0/libexec/share/flatcam, but for me flatcam didn't pick them up from this location.

tomoyanonymous commented 6 years ago

Thank you for your quick work! I'm still gonna install Xcode10 sorry. I can't update my matplotlib because of old xcode cli, after updating I'll try merging.

And resource problem, I remembered I struggled with similar things but I don't know why I didn't reflect them to codes... Also we might need to use system "python", *Language::Python.setup_install_args(prefix) instead of virtualenv_install_with_resources like here

If it still fails, we can copy files manually as Formula Cookbook says like share.install Dir["share/*"]

(And more, I found that now we can see flatcam on pip...)

julianrendell commented 6 years ago

Re setup_install, I'm confused what they mean by "bindings"; I read that as Python wrapper around a (C/C++/other language) library. Which flatcam isn't.

I quickly installed with pip3 install flatcam version, and went yay - python 3 & qt5. And then got confused, as the version is 9, not 8.5.

Went to the PyPi page (https://pypi.org/project/flatcam), downloaded the archive, and noticed the code doesn't match master from flatcam.org. A little more digging and I realized the maintainer for the PyPi package is not the main author, but is the author of this declined pull request: https://bitbucket.org/jpcgt/flatcam/pull-requests/75/python3-and-pyqt5-port/diff

It looks like the PyPi package is not from the official tree.

I'm not sure I understand BitBucket's web pages, but it looks like the PyPi package is not getting updates from the official tree; I think it's one fix behind already.

Might be wise to make a different brew if you use the PyPi package, and add a prefix to the name so it's not easily confused with the original flatcam.

The pip version also has the missing icons/resources issue :-)

I'm going to remove the pip and rebuild the official one for now.

tomoyanonymous commented 6 years ago

Wow it's really confusing and typically open-sourcy. I'm down to track official tree for now. Also the reason why I'm keeping this formula to non-core formula is only it depends on pyqt4 so if the official tree is updated to pyqt5 I will make a pull request to homebrew-core repo.

julianrendell commented 6 years ago

👍 on all accounts... and once the shared resources (icons) location gets figured out.

tomoyanonymous commented 6 years ago

I updated my xcode to 10, merged your request and tried to find the cause. And exactly failed to build at the same point you pointed first.

That seems because homebrew builds everything from source even it's python resources(pip install -v --no-deps --no-binary :all: --ignore-installed) and building matplotlib and scipy from source fails.

I tested with brew install --debug --verbose flatcam and it stopped in an installation of matplotlib with the error

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cmath:313:9: error: no member named 'signbit' in the global namespace using ::signbit;

...

Then I ignored error and entered shell (you can enter shell at the error point in --debug), and did /usr/local/Cellar/flatcam/8.5.0/libexec/bin/pip install matplotlib. This downloaded pre-built binary and was successfly installed. scipy was too.

And the installation itself is finished.

This seems Xcode's sdk problem but I'm not sure yet


Then resource problem.

Also, I confirmed icons should be under bin/share/ despite bin/flatcam calls FlatCAMApp.py in site-packages. It's weird but I added bin.install Dir["*.py","tclCommands","descartes","share"] after virtualenv installation so it would be resolved.


However, still as you said, setup.py in master is missing resources ToolDblSided.py ToolMeasurement.py ToolTransform.py. I manually moved it and it runned.

I found there's already pull request on that.

So for now, it would be better to manually copy these files somehow until it is merged. I'm gonna separate issue into matplotlib&scipy problem and resource problem.

julianrendell commented 6 years ago

Thanks for including the fixes, and the description of how you debugged the brew; I was vaguely aware of brews debugging process, but haven't used it yet.

Not sure if it's an XCode issue or a matplot issue (and some conflict in C spec versions); I just updated the reference to the latest version of matplot and it built.

I agree it's a bit annoying that brew installs everything from source rather than using the prebuilt pip's. But it does make the virtualenv pure and clean, which makes sense. You'd should only need to do this because there's something incompatible with the current "normal" install of home-brew.

Here's hoping upstream flatcam fixes the missing files in setup.py soon, and also switches to QT5. I suspect then it'll be installable without needing to be in a virtualenv.