danieljfarrell / pvtrace

Optical ray tracing for luminescent materials and spectral converter photovoltaic devices
Other
97 stars 94 forks source link

build from source fails #42

Open keithbriggs opened 3 years ago

keithbriggs commented 3 years ago

I did python3 setup.py build, but then python3 setup.py install fails on this step: Running Rtree-0.9.4/setup.py -q bdist_egg --dist-dir /tmp/easy_install-_ns3zuje/Rtree-0.9.4/egg-dist-tmp-xpt3goi2

AttributeError: python3: undefined symbol: Error_GetLastErrorNum

This is on an up-to-date Ubuntu 18 system.

danieljfarrell commented 3 years ago

Try

sudo apt-get install libspatialindex

RTree wraps this library, it needs to be in place on the system before for the install to work.

I'll update the docs with a build from source section.

keithbriggs commented 3 years ago

kbriggs> sudo apt-get install libspatialindex

Reading package lists... Done Building dependency tree
Reading state information... Done E: Unable to locate package libspatialindex

keithbriggs commented 3 years ago

Should be:

sudo apt-get install libspatialindex-dev

danieljfarrell commented 3 years ago

Thanks for coming back to report that, will help when I update the docs.

keithbriggs commented 3 years ago

Thanks - it's all built now, but I can't run it because there are some python 3.7 dependencies, and I have 3.6.9 :(

danieljfarrell commented 3 years ago

Did you try making an virtual environment on Python 3.7.

I've tested this on Linux using Conda. After you have installed conda,

conda create --name pvtrace-env python=3.7.8
conda activate pvtrace-env
conda install Rtree
pip install pvtrace

It installs from pip rather than source.

But you could download the source and use

pip install -e .

From inside the pvtrace directory (ie the one that contains setup.py)

This would be a little like creating a development environment.

keithbriggs commented 3 years ago

I didn't try a virtual environment - I don't like the concept as it does things I can't see.

Does the second way ("pip install -e .") avoid Conda?


From: Daniel notifications@github.com Sent: 07 October 2020 11:01 To: danieljfarrell/pvtrace pvtrace@noreply.github.com Cc: Briggs,KM,Keith,TUD2 R keith.briggs@bt.com; Author author@noreply.github.com Subject: Re: [danieljfarrell/pvtrace] build from source fails (#42)

Did you try making an virtual environment on Python 3.7?

I've tested this on Linux using Conda. After you have installed conda,

conda create --name pvtrace-env python=3.7.8 conda activate pvtrace-env conda install Rtree pip install pvtrace

It installs from pip rather than source.

But you could download the source and use

pip install -e .

From inside the pvtrace directory (ie the one that contains setup.py)

This would be a little like creating a development environment.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdanieljfarrell%2Fpvtrace%2Fissues%2F42%23issuecomment-704830523&data=02%7C01%7Ckeith.briggs%40bt.com%7C72acf56d2ffa4bf6341c08d86aa7f5c5%7Ca7f356889c004d5eba4129f146377ab0%7C0%7C0%7C637376616895431393&sdata=lxvkEU1BCBZCcHwQ1kA87%2BPJ4%2BHeoEDGbW7bMCU%2BOD4%3D&reserved=0, or unsubscribehttps://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABHIQEOGVUEED6DQJFNEOGTSJQ36LANCNFSM4SGQRM5A&data=02%7C01%7Ckeith.briggs%40bt.com%7C72acf56d2ffa4bf6341c08d86aa7f5c5%7Ca7f356889c004d5eba4129f146377ab0%7C0%7C0%7C637376616895441356&sdata=wRErqi%2FmAH82LJ0Uw8mPzRQSSO8x%2BuZ7eIJX%2BBqX6NA%3D&reserved=0.

danieljfarrell commented 3 years ago

No all that pip install -e . does is tell pip to install the python package described by the setup.py file in the named directory, rather then to search and download from PyPI. In your case that would still be system python which is the wrong version.

keithbriggs commented 3 years ago

Thanks - I found that I did have python 3.7.5 on my system (python3 was 3.6), and sudo python3.7 setup.py install worked. However, now I get:

kbriggs@Dell:~> python3.7 Python 3.7.5 (default, Nov 7 2019, 10:50:52) [GCC 8.3.0] on linux Type "help", "copyright", "credits" or "license" for more information.

from pvtrace import * Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.7/dist-packages/pvtrace-2.1.5-py3.7.egg/pvtrace/init.py", line 20, in File "/usr/local/lib/python3.7/dist-packages/pvtrace-2.1.5-py3.7.egg/pvtrace/data/fluro_red.py", line 2, in File "/usr/lib/python3/dist-packages/scipy/init.py", line 114, in from scipy._lib._ccallback import LowLevelCallable File "/usr/lib/python3/dist-packages/scipy/_lib/_ccallback.py", line 1, in from . import _ccallback_c ImportError: cannot import name '_ccallback_c' from 'scipy._lib' (/usr/lib/python3/dist-packages/scipy/_lib/init.py)

danieljfarrell commented 3 years ago

This is getting away from pvtrace and more the specifics of your system so my comments will not be too useful. But it seems that Scipy is not installed properly, it looks like it is missing some C libraries or headers. If you come up with a build from source recipe please do come back and share.

keithbriggs commented 3 years ago

Ok, thanks again - I'll look into that.

danieljfarrell commented 3 years ago

Did you have any luck with building the dependencies from source? It would be interesting to know how to do it, I think the main difficulty is libspatialindex?

keithbriggs commented 3 years ago

I tried some things but I can't remember what now. I'll check again.

danieljfarrell commented 3 years ago

I wonder if it's worth trying to make a Dockerfile targeting a common Linux disto. to test this? I could help with that, as I don't have a Linux machine at the moment, but can run Docker. What do you think?

keithbriggs commented 3 years ago

Could be good, but I have no specific knowledge of Docker. And I don't need pvtrace at the moment. I have several linux machines, and probably the best would be for me to upgrade one to the latest version of everything, and try to install again in the standard way.

keithbriggs commented 3 years ago

I followed your conda instructions exactly on a new Ubuntu machine. I had to change

conda create --name pvtrace-env python=3.7.8

to

conda create --name pvtrace-env python=3.8

To make it work. But now I get:

(base) kbriggs:~$ python3 hello_world.py 
Traceback (most recent call last):
  File "hello_world.py", line 4, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'

Doesn't the conda stuff install all dependencies? If not, how do I get numpy when using conda?

danieljfarrell commented 3 years ago

I think pvtrace is stuck on python 3.7.x at the moment, due to some dependencies.

conda create --name pvtrace-env python=3.7.8 will create an empty conda environment so nothing will be installed.

If you are happy to use virtual environment then full list of commands are,

conda create --name pvtrace-env python=3.7.8
conda activate pvtrace-env
conda install Rtree
pip install pvtrace

The continuous integration scripts builds on linux and currently passes using this method, https://github.com/danieljfarrell/pvtrace/blob/master/.github/workflows/pythonpackage.yml

keithbriggs commented 3 years ago

The line conda create --name pvtrace-env python=3.7.8 gives me:


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

  - python=3.7.8

Current channels:

  - https://repo.anaconda.com/pkgs/main/linux-64
  - https://repo.anaconda.com/pkgs/main/noarch
  - https://repo.anaconda.com/pkgs/r/linux-64
  - https://repo.anaconda.com/pkgs/r/noarch
danieljfarrell commented 3 years ago
Screenshot 2021-02-05 at 17 09 42

Yes is seems that the linux-64 channel does not actually have that version.

They do have 3.7.7 and 3.7.9