3fon3fonov / exostriker

Transit and Radial velocity Interactive Fitting tool for Orbital analysis and N-body simulations: The Exo-Striker
MIT License
122 stars 20 forks source link

TLS not working with Python3.8 #67

Closed jvines closed 3 years ago

jvines commented 3 years ago

Hi @3fon3fonov ,

I'm trying to run TLS, but it fails with the following error

Transit Least Squares TLS 1.0.25 (04 June 2020)
Creating model cache for 23 durations
Searching 1893 data points, 8422 periods from 0.602 to 25.167 days
Using all 8 CPU threads
Traceback (most recent call last):
  File "/Users/jvines/github/exostriker/exostriker/lib/worker.py", line 64, in run
    result = self.fn()
  File "/Users/jvines/github/exostriker/exostriker/gui.py", line 4722, in <lambda>
    worker_tls_ = Worker(lambda:  self.tls_search(resid = resid) )# Any other args, kwargs are passed to the run
  File "/Users/jvines/github/exostriker/exostriker/gui.py", line 4760, in tls_search
    tls_results = tls_model.power(period_min = tls_period_min, period_max=tls_period_max,
  File "/Users/jvines/anaconda3/envs/exostriker/lib/python3.8/site-packages/transitleastsquares/main.py", line 117, in power
    pbar = tqdm(total=numpy.size(periods), smoothing=0.3, bar_format=bar_format)
  File "/Users/jvines/anaconda3/envs/exostriker/lib/python3.8/site-packages/tqdm/std.py", line 561, in __new__
    with cls.get_lock():  # also constructs lock if non-existent
  File "/Users/jvines/anaconda3/envs/exostriker/lib/python3.8/site-packages/tqdm/std.py", line 660, in get_lock
    cls._lock = TqdmDefaultWriteLock()
  File "/Users/jvines/anaconda3/envs/exostriker/lib/python3.8/site-packages/tqdm/std.py", line 98, in __init__
    cls.create_mp_lock()
  File "/Users/jvines/anaconda3/envs/exostriker/lib/python3.8/site-packages/tqdm/std.py", line 122, in create_mp_lock
    cls.mp_lock = RLock()
  File "/Users/jvines/anaconda3/envs/exostriker/lib/python3.8/multiprocessing/context.py", line 73, in RLock
    return RLock(ctx=self.get_context())
  File "/Users/jvines/anaconda3/envs/exostriker/lib/python3.8/multiprocessing/synchronize.py", line 187, in __init__
    SemLock.__init__(self, RECURSIVE_MUTEX, 1, 1, ctx=ctx)
  File "/Users/jvines/anaconda3/envs/exostriker/lib/python3.8/multiprocessing/synchronize.py", line 80, in __init__
    register(self._semlock.name, "semaphore")
  File "/Users/jvines/anaconda3/envs/exostriker/lib/python3.8/multiprocessing/resource_tracker.py", line 147, in register
    self._send('REGISTER', name, rtype)
  File "/Users/jvines/anaconda3/envs/exostriker/lib/python3.8/multiprocessing/resource_tracker.py", line 154, in _send
    self.ensure_running()
  File "/Users/jvines/anaconda3/envs/exostriker/lib/python3.8/multiprocessing/resource_tracker.py", line 121, in ensure_running
    pid = util.spawnv_passfds(exe, args, fds_to_pass)
  File "/Users/jvines/anaconda3/envs/exostriker/lib/python3.8/multiprocessing/util.py", line 452, in spawnv_passfds
    return _posixsubprocess.fork_exec(
ValueError: bad value(s) in fds_to_keep

I suspect it might be a python 3.8 thing since it changed how multiprocessing works. They switched from fork to spawn which broke a lot of things.

jvines commented 3 years ago

As a follow-up. Reverting to Python 3.7 fixed the issue

3fon3fonov commented 3 years ago

Interesting... I am running python3.8 all the time and I never experienced this problem.

Perhaps is anaconda3 related? Update tqdm.

when I find time I will try to reproduce your problem. Which MAC OS you are running?

3fon3fonov commented 3 years ago

I just verified, TLS within the Exo-Striker works perfectly fine on Python3.8 and Linux.

please run:

$ python3.8 exostriker_gui.py -debug

and check your transitleastsquares version (you may also paste the whole output for inspection).

Mine is:

transitleastsquares==1.0.24

and tqdm

tqdm==4.48.2

jvines commented 3 years ago

I'm running OS X Catalina.

I'll create a new environment to reproduce the error and update here

3fon3fonov commented 3 years ago

Any progress on this? Or it was permanently solved?

3fon3fonov commented 3 years ago

I suppose this was already fixed. Please re-open if needed.