Skip to content

Issue with numpy on Win10 #7

Description

@tjayasinghe

Ran into this issue trying to run the example notebook on Windows 10 + Anaconda. The code block that failed was the example on sequential inference.

numpy works perfectly fine if I run it elsewhere.

The notebook has no issues running on Debian through WSL, so I presume this is something to do with multiprocessing on windows.


RemoteTraceback Traceback (most recent call last)
RemoteTraceback:
"""
Traceback (most recent call last):
File "C:\Users\thari\Anaconda3\lib\site-packages\multiprocess\pool.py", line 121, in worker
result = (True, func(*args, **kwds))
File "C:\Users\thari\Anaconda3\lib\site-packages\multiprocess\pool.py", line 44, in mapstar
return list(map(*args))
File "c:\users\thari\documents\research\nbi\win10\nbi\src\nbi\utils.py", line 22, in parallel_simulate
simulation = simulator(params)
File "", line 4, in sine
NameError: name 'np' is not defined
"""

The above exception was the direct cause of the following exception:

NameError Traceback (most recent call last)
in
40 min_lr=0.0002, # learning rate decays from lr to min_lr at the last epoch
41 f_val=0.1, # fraction used as validation set
---> 42 early_stop_patience=5 # stop training if val loss not improve by 5 epochs
43 )

c:\users\thari\documents\research\nbi\win10\nbi\src\nbi\engine.py in run(self, obs, n_per_round, n_rounds, n_epochs, n_reuse, y_true, train_batch, val_batch, project, wandb_enabled, neff_stop, early_stop_train, early_stop_patience, f_val, lr, min_lr, x_file, y_file, decay_type, debug)
181 """
182 if len(self.x_all) == self.round:
--> 183 self.prepare_data(obs, n_per_round, y_true=y_true)
184
185 for i in range(n_rounds):

c:\users\thari\documents\research\nbi\win10\nbi\src\nbi\engine.py in prepare_data(self, obs, n_per_round, y_true)
276 self.corner(obs, ys, y_true=y_true)
277
--> 278 x_path, good = self.simulate(ys)
279 np.save(os.path.join(self.directory, str(self.round)) + '_x.npy', x_path[good])
280 np.save(os.path.join(self.directory, str(self.round)) + '_y.npy', ys[good])

c:\users\thari\documents\research\nbi\win10\nbi\src\nbi\engine.py in simulate(self, thetas)
508
509 with Pool(self.n_jobs) as p:
--> 510 masks = p.map(parallel_simulate, jobs)
511 masks = np.concatenate(masks)
512

~\Anaconda3\lib\site-packages\multiprocess\pool.py in map(self, func, iterable, chunksize)
266 in a list that is returned.
267 '''
--> 268 return self._map_async(func, iterable, mapstar, chunksize).get()
269
270 def starmap(self, func, iterable, chunksize=None):

~\Anaconda3\lib\site-packages\multiprocess\pool.py in get(self, timeout)
655 return self._value
656 else:
--> 657 raise self._value
658
659 def _set(self, i, obj):

NameError: name 'np' is not defined

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions