facebookresearch/ParlAI

Custom ParlAI script: Module and import errors with win32con and iopath

nopynospy opened this issue · 6 comments

Hello, I am new to ParlAI. I am having issues with running ParlAI as an imported library in Python.

I am able to use 'parlai interactive' in my console to chat with the empathetic model, but I wanted to be able to call it from a python script.

I used 'from parlai.scripts import interactive' in my python script and keep receiving the following errors.

  1. ModuleNotFoundError: No module named 'win32con'
  2. ModuleNotFoundError: No module named 'win32con'
  3. ImportError: parlai now requires iopath for some I/O operations. Please run pip install iopath

I did a pip install iopath and it was installed and registered in my requirements.txt. Then, I also tried to pip install win32con and received the errors:

  1. ERROR: Could not find a version that satisfies the requirement win32con (from versions: none)
  2. ERROR: No matching distribution found for win32con

I tried installing ParlAI using both pip install and the git clone method found in the documentations, but the issue occurs in both installation methods. I also tried using subprocess library to call 'parlai interactive', but it does not work either. I also copied the codes from https://parl.ai/docs/cli_custom.html and the error persists.

It's okay, I found the solution to this. https://paulcunningham.dev/windows-10-python-error-no-module-named-win32com/ this link says that he upgraded to Python 3.8 and ran into a similar problem.

However, his solution did not work in my case. What I did was, I downgraded to python 3.7. If I'm not mistaken, while I was trying ParlAI out in AWS, I got a message from ParlAI saying I must use 3.7+.

3.8 works if its just calling 'parlai interactive' from command, but 3.7 works better if you want write custom Python scripts.

Thanks for leaving your findings

It's okay, I found the solution to this. https://paulcunningham.dev/windows-10-python-error-no-module-named-win32com/ this link says that he upgraded to Python 3.8 and ran into a similar problem.

However, his solution did not work in my case. What I did was, I downgraded to python 3.7. If I'm not mistaken, while I was trying ParlAI out in AWS, I got a message from ParlAI saying I must use 3.7+.

3.8 works if its just calling 'parlai interactive' from command, but 3.7 works better if you want write custom Python scripts.

Thanks @nopynospy , I was having a hard time running it on Windows as it was working fine on Ubuntu. I changed my env to Python 3.8 and it worked like a charm.

We should add to the README that Windows isn't supported but some users report success with 3.8 on windows

try this:
pip uninstall portalocker
pip uninstall pywin32
pip install portalocker==2.0
pip install pywin32==225

but I'm failed with:
parlai interactive xxxxx

why not try wsl2, now it supported cuda.