Hello @denisgiannelli, thanks for posting! I suspect you need to use Visual C++ Build Tools to compile pycocotools, since there aren’t any pre-built packages available? Please let me know if I am understanding this correctly, or feel free to correct me!
- Have you followed all the instructions here?
- If so, are you able to import the newly compiled library in another environment outside of FME?
This will let us know if it’s been installed correctly. Hope this helps, Kailin
Hello @denisgiannelli, thanks for posting! I suspect you need to use Visual C++ Build Tools to compile pycocotools, since there aren’t any pre-built packages available? Please let me know if I am understanding this correctly, or feel free to correct me!
- Have you followed all the instructions here?
- If so, are you able to import the newly compiled library in another environment outside of FME?
This will let us know if it’s been installed correctly. Hope this helps, Kailin
Hi @kailinatsafe , thank you for your response ! :)
- Yes, I followed all the instructions present on the readme file.
When I open the Developer Command Prompt for VS 2022 (the 2015 link that philferriere does not work, there is a setup package missing or damaged), I immediately check PATH to see if the VS Build Tools are present ("On Windows, you must have the Visual C++ 2015 build tools on your path"), and they are:
I then follow the pip install recommendation with
"pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI"
At this point, it is interesting to notice that, after collecting, it does not "Building wheels for collected packages: pycocotools", just as in the screenshot of philferriere. The program ends in "Preparing metadata (setup.py) ... done"
Alternatively, if I try to pip install it using FME's python intepreter:
" "C:\\Program Files\\FME2023\\fme.exe" python -m pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI "
it complains about the lack of the module named "Cython". This is rare since Cython is available as a module inside the FME Python.
Anyway, I am in a trial-and-test loop here...
Denis
Hi @kailinatsafe , thank you for your response ! :)
- Yes, I followed all the instructions present on the readme file.
When I open the Developer Command Prompt for VS 2022 (the 2015 link that philferriere does not work, there is a setup package missing or damaged), I immediately check PATH to see if the VS Build Tools are present ("On Windows, you must have the Visual C++ 2015 build tools on your path"), and they are:
I then follow the pip install recommendation with
"pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI"
At this point, it is interesting to notice that, after collecting, it does not "Building wheels for collected packages: pycocotools", just as in the screenshot of philferriere. The program ends in "Preparing metadata (setup.py) ... done"
Alternatively, if I try to pip install it using FME's python intepreter:
" "C:\\Program Files\\FME2023\\fme.exe" python -m pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI "
it complains about the lack of the module named "Cython". This is rare since Cython is available as a module inside the FME Python.
Anyway, I am in a trial-and-test loop here...
Denis
Hey @denisgiannelli, I did a quick test and I don't think Cython is included with FME python natively, you will need to install it. Kailin.
Hi @kailinatsafe , thank you for your response ! :)
- Yes, I followed all the instructions present on the readme file.
When I open the Developer Command Prompt for VS 2022 (the 2015 link that philferriere does not work, there is a setup package missing or damaged), I immediately check PATH to see if the VS Build Tools are present ("On Windows, you must have the Visual C++ 2015 build tools on your path"), and they are:
I then follow the pip install recommendation with
"pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI"
At this point, it is interesting to notice that, after collecting, it does not "Building wheels for collected packages: pycocotools", just as in the screenshot of philferriere. The program ends in "Preparing metadata (setup.py) ... done"
Alternatively, if I try to pip install it using FME's python intepreter:
" "C:\\Program Files\\FME2023\\fme.exe" python -m pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI "
it complains about the lack of the module named "Cython". This is rare since Cython is available as a module inside the FME Python.
Anyway, I am in a trial-and-test loop here...
Denis
Hello @denisgiannelli, this is not something we would usually do, but I ended up raising this internally and had a hand putting together the following instructions for installing pycoco tools!
1) Install a Python interpreter that matches the shipped FME Python version and bit architecture (64-bit Python 3.11.3 for FME23)
2) Open the x64 Native Tools Command Prompt for VS 2022 (64-bit to match with the FME and Python)
3) Make sure the PATH environment variable contains the path to your Python home and Python home\\script
4) Run the command from https://github.com/philferriere/cocoapi#this-clones-readme
5) Should be installed
I hope these steps work for you! Happy to help, Kailin.
Hi @kailinatsafe , thank you for your response ! :)
- Yes, I followed all the instructions present on the readme file.
When I open the Developer Command Prompt for VS 2022 (the 2015 link that philferriere does not work, there is a setup package missing or damaged), I immediately check PATH to see if the VS Build Tools are present ("On Windows, you must have the Visual C++ 2015 build tools on your path"), and they are:
I then follow the pip install recommendation with
"pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI"
At this point, it is interesting to notice that, after collecting, it does not "Building wheels for collected packages: pycocotools", just as in the screenshot of philferriere. The program ends in "Preparing metadata (setup.py) ... done"
Alternatively, if I try to pip install it using FME's python intepreter:
" "C:\\Program Files\\FME2023\\fme.exe" python -m pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI "
it complains about the lack of the module named "Cython". This is rare since Cython is available as a module inside the FME Python.
Anyway, I am in a trial-and-test loop here...
Denis
@kailinatsafe , OMG thank you very much, it worked !! :D
In addition to your instructions, I also had to do the following:
- Between your steps number 3 and 4, I had to "pip install cython" and "pip install numpy" (since the python interpreter that I had installed in step 1 was new)
- Right before importing the recently installed pycocotools in FME's Python Caller, i had to insert a path to reference the other python interpreter (see image below)
It works fine like this, so I have no problem to continue my work as an FME author.
Nevertheless, I was curious to understand why I could not import pycocotools directly in the python caller, i.e. just like I do with numpy and cython (see modules imported before the sys.path.insert).
I tried to pip install pycocotools on FME's python, just like I had done with the external python:
- "C:\\Program Files\\FME2023\\fme.exe" python -m pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI"
- It complains because there would be no module Cython loaded: ModuleNotFoundError: No module named 'Cython'
- If I try to "C:\\Program Files\\FME2023\\fme.exe" python -m pip install cython", i get a message saying that cython already exists as a module inside the FME's python.
- I double check this by "C:\\Program Files\\FME2023\\fme.exe" python", help, help(), modules.
- In the list of modules loaded inside FME's python, I see both Cython (capital C) and cython (lowercase c), but of course no pycocotools.
- In the list of modules loaded inside the external python, I see Cython, cython and then pycocotools, in this case because I managed to install it correctly
Anyway, I am just reporting all this because it might be helpful to other users. But I can already proceed with my authoring work!
Once more: thank you very, very much!
Greetings,
Denis Giannelli