question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ValueError: cannot find context for 'fork'

See original GitHub issue

I’m running it on Windows 10. I get the error when running

from pandarallel import pandarallel
pandarallel.initialize()
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-5-b7dddfb62cf5> in <module>
----> 1 from pandarallel import pandarallel
      2 pandarallel.initialize()

~\Anaconda3\envs\pipeline\lib\site-packages\pandarallel\__init__.py in <module>
      1 __version__ = "1.5.1"
      2 
----> 3 from .pandarallel import pandarallel

~\Anaconda3\envs\pipeline\lib\site-packages\pandarallel\pandarallel.py in <module>
     25 # Python 3.8 on MacOS by default uses "spawn" instead of "fork" as start method for new
     26 # processes, which is incompatible with pandarallel. We force it to use "fork" method.
---> 27 context = get_context("fork")
     28 
     29 # By default, Pandarallel use all available CPUs

~\Anaconda3\envs\pipeline\lib\multiprocessing\context.py in get_context(self, method)
    236             return self._actual_context
    237         else:
--> 238             return super().get_context(method)
    239 
    240     def set_start_method(self, method, force=False):

~\Anaconda3\envs\pipeline\lib\multiprocessing\context.py in get_context(self, method)
    190             ctx = _concrete_contexts[method]
    191         except KeyError:
--> 192             raise ValueError('cannot find context for %r' % method) from None
    193         ctx._check_available()
    194         return ctx

ValueError: cannot find context for 'fork'

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

9reactions
om-hbcommented, Sep 21, 2020

I had exactly the same problem with Python 3.6.10 in VS Code on a Windows 10 machine. Could solve it by downgrading pandarallel to version 1.4.8.

1reaction
nalepaecommented, Sep 21, 2020

As written in the Readme, do you use WSL?

Read more comments on GitHub >

github_iconTop Results From Across the Web

On Windows 10, ValueError: cannot find context for 'fork' #129
When I tried to run visualise_data.ipynb on Windows, I received the following error: D:\l5kit\l5kit\l5kit\dataset\select_agents.py in 20 ...
Read more >
Wikipedia extractor problem ValueError: cannot find context ...
ValueError : cannot find context for 'fork'. Here is stack trace with "spawn" instead of "fork" parameter. "spawn" parameter stack trace.
Read more >
context.py - Google Git
'''Set list of module names to try to load in forkserver process. ... raise ValueError('cannot find context for %r' % method) from None....
Read more >
Multiprocessing Context in Python
In particular, locks created using the fork context cannot be passed to processes started using the spawn or forkserver start methods.
Read more >
Using the multiprocessing Python Module - PyOxidizer
In this scenario, your application code should call multiprocessing. set_start_method("fork", force=True) before multiprocessing functionality is used.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found