Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Library not working.... #81

Closed
murilobellatini opened this issue Mar 14, 2020 · 6 comments
Closed

Library not working.... #81

murilobellatini opened this issue Mar 14, 2020 · 6 comments

Comments

@murilobellatini
Copy link

murilobellatini commented Mar 14, 2020

Hello everyone!

While trying to run the example cases and I'm receiving the following error:

Code

import pandas as pd
import pandarallel
pandarallel.initialize()

def func(x):
    return math.sin(x.a**2) + math.sin(x.b**2)

if __name__ == '__main__':
    df_size = int(5e6)
    df = pd.DataFrame(dict(a=np.random.randint(1, 8, df_size),
                           b=np.random.rand(df_size)))
    res_parallel = df.parallel_apply(func, axis=1, progress_bar=True)

Error

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<timed exec> in <module>

~\.conda\envs\ingestion-env\lib\site-packages\pandarallel\pandarallel.py in closure(data, func, *args, **kwargs)
    434         try:
    435             pool = Pool(
--> 436                 nb_workers, worker_init, (prepare_worker(use_memory_fs)(worker),)
    437             )
    438 

~\.conda\envs\ingestion-env\lib\multiprocessing\context.py in Pool(self, processes, initializer, initargs, maxtasksperchild)
    117         from .pool import Pool
    118         return Pool(processes, initializer, initargs, maxtasksperchild,
--> 119                     context=self.get_context())
    120 
    121     def RawValue(self, typecode_or_type, *args):

~\.conda\envs\ingestion-env\lib\multiprocessing\pool.py in __init__(self, processes, initializer, initargs, maxtasksperchild, context)
    174         self._processes = processes
    175         self._pool = []
--> 176         self._repopulate_pool()
    177 
    178         self._worker_handler = threading.Thread(

~\.conda\envs\ingestion-env\lib\multiprocessing\pool.py in _repopulate_pool(self)
    239             w.name = w.name.replace('Process', 'PoolWorker')
    240             w.daemon = True
--> 241             w.start()
    242             util.debug('added worker')
    243 

~\.conda\envs\ingestion-env\lib\multiprocessing\process.py in start(self)
    110                'daemonic processes are not allowed to have children'
    111         _cleanup()
--> 112         self._popen = self._Popen(self)
    113         self._sentinel = self._popen.sentinel
    114         # Avoid a refcycle if the target function holds an indirect

~\.conda\envs\ingestion-env\lib\multiprocessing\context.py in _Popen(process_obj)
    320         def _Popen(process_obj):
    321             from .popen_spawn_win32 import Popen
--> 322             return Popen(process_obj)
    323 
    324     class SpawnContext(BaseContext):

~\.conda\envs\ingestion-env\lib\multiprocessing\popen_spawn_win32.py in __init__(self, process_obj)
     87             try:
     88                 reduction.dump(prep_data, to_child)
---> 89                 reduction.dump(process_obj, to_child)
     90             finally:
     91                 set_spawning_popen(None)

~\.conda\envs\ingestion-env\lib\multiprocessing\reduction.py in dump(obj, file, protocol)
     58 def dump(obj, file, protocol=None):
     59     '''Replacement for pickle.dump() using ForkingPickler.'''
---> 60     ForkingPickler(file, protocol).dump(obj)
     61 
     62 #

AttributeError: Can't pickle local object 'prepare_worker.<locals>.closure.<locals>.wrapper'

I'm working on a Jupyter Lab notebook with a conda environment: What can I do?

@nalepae
Copy link
Owner

nalepae commented Apr 5, 2020

Hello!

Are you on Windows?

@murilobellatini
Copy link
Author

@nalepae yes!

@XiaomoWu
Copy link

Same error here. On Jupyterlab 2.0.1 and Win10 2004.

@nalepae
Copy link
Owner

nalepae commented Apr 13, 2020

As written in the Requirements part of the README:

On Windows, Pandaral·lel will works only if the Python session (python, ipython, jupyter notebook, jupyter lab, ...) is executed from Windows Subsystem for Linux (WSL).
On Linux & macOS, nothing special has to be done.

It is still planned to have Pandarallel working natively on Windows though.

@OwaisKarni
Copy link

As written in the Requirements part of the README:

On Windows, Pandaral·lel will works only if the Python session (python, ipython, jupyter notebook, jupyter lab, ...) is executed from Windows Subsystem for Linux (WSL).
On Linux & macOS, nothing special has to be done.

It is still planned to have Pandarallel working natively on Windows though.

Any update for Windows??

@nalepae
Copy link
Owner

nalepae commented Mar 14, 2022

Fixed on pandarallel v1.6.0.

Be sure to checkout the documentation.

@nalepae nalepae closed this as completed Mar 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants