Repository: biolab/orange3-timeseries (language: python)

Issue:
Unable to install Timeseries add-on: command failed
<!-- 
Thanks for taking the time to report a bug!
If you're raising an issue about an add-on (i.e., installed via Options > Add-ons), raise an issue in the relevant add-on's issue tracker instead. See: https://github.com/biolab?q=orange3
To fix the bug, we need to be able to reproduce it. Please answer the following questions to the best of your ability.
-->


**What's wrong?**
My colleague is trying to install the Timeseries add-on trough Options -> Add-ons. During installation (after selecting the add-on and clicking OK), error messages appear:
Short error message:
`Command failed: python python -m pip install --upgrade --upgrade-strategy=only-if-needed Orange3-Timeseries==0.6.0 exited with non zero status.`

Long error message:
[Timeseries install error.txt](https://github.com/biolab/orange3/files/13439408/Timeseries.install.error.txt)
The problem does not occur with other add-ons

**How can we reproduce the problem?** 
I don't know. I have a Mac with a different processor (M1, not M1 Pro), and have a slightly older OS version (14.1, not 14.4.1) and had no problems installing the add-on


**What's your environment?**
<!-- To find your Orange version, see "Help → About → Version" or `Orange.version.full_version` in code -->
- Operating system: Mac OS 14.1.1
- Orange version: 3.36.2
- How you installed Orange: 3.35 from DMG, updated through Options menu.



Discussion / hints:
orange3-timseries has severe problems with lxml library with some wheels missing:

- [X] **MacOS with Intel processor**:  lxml build wheels for MacOS SDK 11. Our old installer (for versions <=3.35) included Python built on SDK 10.9. **Solution: install a new version of Orange since our [new Intel installer](https://download.biolab.si/download/files/Orange3-3.36.1-Python3.9.12.dmg) fixes the issue**. It uses Python built on SDK 11.
- [ ] **MacOS with Apple silicon processor**: lxml doesn't provide wheels for ARM for Python <=3.10, which causes problems in our installer. We asked them to provide those wheels: https://bugs.launchpad.net/lxml/+bug/1980575. We are waiting for a response.

So, how does that explain that the Timeseries add-on is present on my Silicon Mac? Does it mean that, unknowingly, I'm running 3.36 for Intel processors through Rosetta 2? If that is the case, I guess I should suggest to my friend that he downloads and installs the Intel version of 3.36 ...
There may be two reasons:
- you are running the Orange 3.36.1 (from Orange 3.36.1 Installer for Intel) through Rosetta.
- you have appropriate libraries to build LXML on your computer. 

So until we (I'm looking into how to get rid of LXML) or LXML solve the problem, the solutions are: 
- Use [Orange Intel installer](https://download.biolab.si/download/files/Orange3-3.36.1-Python3.9.12.dmg) even though you are having Apple silicon. We noticed some problems with this installer on Apple Silicon after updating Python, so it may not work for some.
- Use the Apple silicon installer and install appropriate libraries to build lxml before installing Time Series addon: 
   ```
   brew install automake libtool
   /Applications/Orange.app/Contents/MacOS/pip install cython
   ```
 
I'm running 3.36.2 so it must be the second reason. I'm not aware of having ever installed "appropriate libraries to build LXML on your computer", at least not consciously, because I don't even know what LXML is ...

>   brew install automake libtool
>   /Applications/Orange.app/Contents/MacOS/pip install cython
>   ```

Doesn't work, I get a:
Error: Git must be installed and in your PATH!
/usr/local/Homebrew/Library/Homebrew/version.rb:368:in `initialize': Version value must be a string; got a NilClass () (TypeError)

> * Use [Orange Intel installer](https://download.biolab.si/download/files/Orange3-3.36.1-Python3.9.12.dmg) even though you are having Apple silicon. We noticed some problems with this installer on Apple Silicon after updating Python, so it may not work for some.

Orange3 doesn't startup at all.

> * [x]  **MacOS with Intel processor**:  lxml build wheels for MacOS SDK 11. Our old installer (for versions <=3.35) included Python built on SDK 10.9. **Solution: install a new version of Orange since our [new Intel installer](https://download.biolab.si/download/files/Orange3-3.36.1-Python3.9.12.dmg) fixes the issue**. It uses Python built on SDK 11.

It works
So, the current state: 
- I am helping lxml to improve their wheel-building system: https://github.com/lxml/lxml/pull/388; when it is finished, they will also provide MacOS ARM wheels
- Since it can take some time to be finished, I propose skipping installing yfinace and pandas_datasets on MacOS that require lxml library for now. #262 It will only affect the Yahoo widget.
We merged the temporary solution from #262 and made a release. Now, orange3-timeseries should install successfully. It will lack the Yahoo finance widget on MacOS. We are working towards getting this widget back as soon as possible by helping lxml maintainer to provide wheels.

Fix patch:
diff --git a/setup.py b/setup.py
index 617e115..979d0d2 100644
--- a/setup.py
+++ b/setup.py
@@ -66,14 +66,14 @@
             'statsmodels>=0.13.0',
             'python-dateutil',
             'pandas',  # statsmodels requires this but doesn't have it in dependencies?
-            'pandas_datareader; sys_platform!="darwin"',
+            'pandas_datareader',
             'numpy',
             'scipy>=1.9.2',
             'more-itertools',
             # required to get current timezone
             # adding it does not hurt, Pandas have it as a dependency
             'python-dateutil',
-            'yfinance; sys_platform!="darwin"',
+            'yfinance',
             'pyqtgraph>=0.13.1',
         ],
         extras_require={


Test patch:
diff --git a/orangecontrib/timeseries/tests/test_lxml.py b/orangecontrib/timeseries/tests/test_lxml.py
deleted file mode 100644
index 8bc5cc1..0000000
--- a/orangecontrib/timeseries/tests/test_lxml.py
+++ /dev/null
@@ -1,16 +0,0 @@
-import unittest
-from datetime import datetime
-
-
-class TestReintroduceYahoo(unittest.TestCase):
-    def test_time_bomb(self):
-        """
-        When this test start to fail, check if there are already ARM wheels for
-        LXML library for Python 3.9 and 3.10. If they exist revert commit that part
-        of it is also this test.
-        """
-        self.assertLess(datetime.now(), datetime(2024, 1, 1), "Happy new year")
-
-
-if __name__ == "__main__":
-    unittest.main()