2

I have a code that uses a module which in turn uses the python module "file". Right now when I run my code I get the error -

File "c:\users\sss\appdata\local\programs\python\python36-32\lib\site-packages\enmscripting\common\element.py", line 3, in <module>
from file import FileResult

ModuleNotFoundError: No module named 'file'

So then I went to console and ran "import file". Sure enough I don't have that module.

import file
Traceback (most recent call last):

File "<ipython-input-27-f5da65cb6f61>", line 1, in <module>
import file

ModuleNotFoundError: No module named 'file'

I then proceeded with installing file using pip. Getting the error below. Please advise. I have searched a lot and haven't been able to find a fix.

C:\Users\sss>pip install file
Collecting file
  Using cached https://files.pythonhosted.org/packages/0a/49/317ac8ed10afb25c4c24972ea4de4c5507d6b0ab13bca4941c9a0bdc64ea/file-0.3.0.tar.gz
Requirement already satisfied: cffi>=1.0.0 in c:\users\sss\appdata\local\programs\python\python36-32\lib\site-packages (from file)
Requirement already satisfied: pycparser in c:\users\sss\appdata\local\programs\python\python36-32\lib\site-packages (from cffi>=1.0.0->file)
Installing collected packages: file
  Running setup.py install for file ... error
    Complete output from command c:\users\sss\appdata\local\programs\python\python36-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Public\\Documents\\Wonder
share\\CreatorTemp\\pip-build-fe5vpmot\\file\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec
'))" install --record C:\Users\Public\Documents\Wondershare\CreatorTemp\pip-jqpbad1d-record\install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build\lib.win32-3.6
    creating build\lib.win32-3.6\file
    copying src\file\_libmagic_build.py -> build\lib.win32-3.6\file
    copying src\file\__init__.py -> build\lib.win32-3.6\file
    running egg_info
    writing src\file.egg-info\PKG-INFO
    writing dependency_links to src\file.egg-info\dependency_links.txt
    writing requirements to src\file.egg-info\requires.txt
    writing top-level names to src\file.egg-info\top_level.txt
    reading manifest file 'src\file.egg-info\SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    warning: no previously-included files matching '*.py[cod]' found anywhere in distribution
    warning: no previously-included files matching '__pycache__' found anywhere in distribution
    warning: no previously-included files matching '*.so' found anywhere in distribution
    warning: no previously-included files matching '*.dylib' found anywhere in distribution
    writing manifest file 'src\file.egg-info\SOURCES.txt'
    running build_ext
    generating cffi module 'build\\temp.win32-3.6\\Release\\file._libmagic.c'
    creating build\temp.win32-3.6
    creating build\temp.win32-3.6\Release
    building 'file._libmagic' extension
    creating build\temp.win32-3.6\Release\build
    creating build\temp.win32-3.6\Release\build\temp.win32-3.6
    creating build\temp.win32-3.6\Release\build\temp.win32-3.6\Release
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -Ic:\users\sss\appdata\local\
programs\python\python36-32\include -Ic:\users\sss\appdata\local\programs\python\python36-32\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\
14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files
 (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0
\cppwinrt" /Tcbuild\temp.win32-3.6\Release\file._libmagic.c /Fobuild\temp.win32-3.6\Release\build\temp.win32-3.6\Release\file._libmagic.obj
    file._libmagic.c
    build\temp.win32-3.6\Release\file._libmagic.c(492): fatal error C1083: Cannot open include file: 'magic.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2

Installed Magic again. No change -

C:\Users\sss>pip install libmagic
Collecting libmagic
  Downloading https://files.pythonhosted.org/packages/83/86/419ddfc3879b4565a60e0c75b6d19baec48428cbc2f15aca5320b3d136f6/libmagic-1.0.tar.gz
Installing collected packages: libmagic
  Running setup.py install for libmagic ... done
Successfully installed libmagic-1.0

Error - Same as before

ile._libmagic.c
build\temp.win32-3.6\Release\file._libmagic.c(492): fatal error C1083: Cannot open include file: 'magic.h': No such file or directory
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x86\\cl.exe' failed with exit status 2

Resolved - I downgraded to Python 2.7 and everything works. It appears there are some compatibility issues with Python 3.6.

rfguy
  • 149
  • 1
  • 3
  • 11
  • The error you posted clearly states that magic.h is missing. So you probably need to install or re-install libmagic or magic. – najayaz Jan 08 '19 at 22:09
  • Installed libmagic. No change. – rfguy Jan 08 '19 at 22:14
  • Possible duplicate of [fatal error C1083: Cannot open include file: 'magic.h': No such file or directory](https://stackoverflow.com/questions/46859234/fatal-error-c1083-cannot-open-include-file-magic-h-no-such-file-or-director) – phd Jan 08 '19 at 23:37

1 Answers1

0

Resolved - I downgraded to Python 2.7 and everything works. It appears there are some compatibility issues with Python 3.6.

rfguy
  • 149
  • 1
  • 3
  • 11