rdkit / mmpdb

A package to identify matched molecular pairs and use them to predict property changes.
Other
197 stars 55 forks source link

cannot fix the AttributeError: module '__main__' has no attribute '__spec__' #36

Closed JS0108 closed 2 years ago

JS0108 commented 2 years ago

Dear developer,

I use vscode with Miniconda3-4.5.4 (python=3.6) in Windows. When I run the command line, as shown in the Fragment structures section in README.md:

mmpdb fragment test_data.smi -o test_data.fragments

I get the error message:

Traceback (most recent call last):
  File "C:/Users/User/miniconda3/envs/mmpdb/Scripts/mmpdb", line 4, in <module>
    __import__('pkg_resources').run_script('mmpdb==2.3.dev1', 'mmpdb')
  File "C:\Users\User\miniconda3\envs\mmpdb\lib\site-packages\pkg_resources\__init__.py", line 651, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "C:\Users\User\miniconda3\envs\mmpdb\lib\site-packages\pkg_resources\__init__.py", line 1448, in run_script
    exec(code, namespace, namespace)
  File "c:\users\user\miniconda3\envs\mmpdb\lib\site-packages\mmpdb-2.3.dev1-py3.6.egg\EGG-INFO\scripts\mmpdb", line 11, in <module>
    commandline.main()
  File "C:\Users\User\miniconda3\envs\mmpdb\lib\site-packages\mmpdb-2.3.dev1-py3.6.egg\mmpdblib\commandline.py", line 1054, in main
    parsed_args.command(parsed_args.subparser, parsed_args)
  File "C:\Users\User\miniconda3\envs\mmpdb\lib\site-packages\mmpdb-2.3.dev1-py3.6.egg\mmpdblib\commandline.py", line 181, in fragment_command
    do_fragment.fragment_command(parser, args)
  File "C:\Users\User\miniconda3\envs\mmpdb\lib\site-packages\mmpdb-2.3.dev1-py3.6.egg\mmpdblib\do_fragment.py", line 567, in fragment_command
    pool = create_pool(args.num_jobs)
  File "C:\Users\User\miniconda3\envs\mmpdb\lib\site-packages\mmpdb-2.3.dev1-py3.6.egg\mmpdblib\do_fragment.py", line 396, in create_pool
    pool = multiprocessing.Pool(num_jobs, init_worker)
  File "C:\Users\User\miniconda3\envs\mmpdb\lib\multiprocessing\context.py", line 119, in Pool
    context=self.get_context())
  File "C:\Users\User\miniconda3\envs\mmpdb\lib\multiprocessing\pool.py", line 174, in __init__
    self._repopulate_pool()
  File "C:\Users\User\miniconda3\envs\mmpdb\lib\multiprocessing\pool.py", line 239, in _repopulate_pool
    w.start()
  File "C:\Users\User\miniconda3\envs\mmpdb\lib\multiprocessing\process.py", line 105, in start
    self._popen = self._Popen(self)
  File "C:\Users\User\miniconda3\envs\mmpdb\lib\multiprocessing\context.py", line 322, in _Popen
    return Popen(process_obj)
  File "C:\Users\User\miniconda3\envs\mmpdb\lib\multiprocessing\popen_spawn_win32.py", line 33, in __init__
    prep_data = spawn.get_preparation_data(process_obj._name)
  File "C:\Users\User\miniconda3\envs\mmpdb\lib\multiprocessing\spawn.py", line 172, in get_preparation_data
    main_mod_name = getattr(main_module.__spec__, "name", None)
AttributeError: module '__main__' has no attribute '__spec__'

I reviewed lots of methods fixing this error but nothing changed. It would be great if someone could also help me fix it.

Thanks.

KramerChristian commented 2 years ago

Dear JS0108,

I unfortunately do not know where this error comes from. Quickly Googling it, it seems to be a problem associated with conda as described here: https://stackoverflow.com/questions/45720153/python-multiprocessing-error-attributeerror-module-main-has-no-attribute

Did you already test whether the code runs using a different version of python or Conda?

Bests, Christian

JS0108 commented 2 years ago

Dear developer,

Thanks for your quick reply! I get no error when running the program in linux with python=3.8. But still don't know why I got this error in vscode.

JS0108