Alembic Python 3.8 Install

710 views
Skip to first unread message

Qtm

unread,
Mar 18, 2023, 5:38:37 AM3/18/23
to alembic-discussion
Hi, 
I am new to Alembic, I'm trying to install Alembic on Windows so that I can run it in Python 3.8. I don't really know the process so I complied Boost then IMath then Alembic using Visual Studio 2022, and everything went well. Once I try installing it using 

D:\Alembic\alembic-1.8.5>pip install .

using the setup.py file I get the a long message with following error at the end

      [D:\Alembic\alembic-1.8.5\build\temp.win-amd64-3.8\Release\python\PyAlembic\alembic.vcxproj]
        main.cpp
        Generating Code...
           Creating library D:/Alembic/alembic-1.8.5/build/temp.win-amd64-3.8/Release/python/PyAlembic/Release/alembic.lib and object D:/Alembic/alembic-1.8.5/build/temp.win-amd64-3.8/Release/python/PyAlembic/Release/alembic.exp
        alembic.vcxproj -> D:\Alembic\alembic-1.8.5\build\temp.win-amd64-3.8\Release\python\PyAlembic\Release\alembic.pyd
        1>Building Custom Rule D:/Alembic/alembic-1.8.5/CMakeLists.txt
      error: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/site-packages\\iexmodule.la'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> alembic

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

All I really want to do is use Alembic in Python, is there an easy way to install it that I am missing. Any help would be appreciated. Thanks.

Lucas Miller

unread,
Mar 20, 2023, 12:46:43 PM3/20/23
to alembic-d...@googlegroups.com
That setup.py file has some problems and hasnt been updated in a while:


Can you instead just do: 
cmake --target install

Lucas

--
You received this message because you are subscribed to the Google Groups "alembic-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to alembic-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/alembic-discussion/23535e46-2589-4b6c-8d25-e8ab2313380cn%40googlegroups.com.

Qtm

unread,
Mar 21, 2023, 7:28:21 AM3/21/23
to alembic-discussion
Thank you Lucas for the quick response. Unfortunately after a lot of trial and errors I am still not able to get it to work under python. Here is what I've tried so far.

During CMake generation I select USE_HD5 and USE_PYALEMBIC options in the CMake-GUI and create the build files for VS2022.

If I try "cmake --target install" I get following error

D:\Alembic\alembic-1.8.5>cmake --target install
CMake Error: Unknown argument --target
CMake Error: Run 'cmake --help' for all supported options.

looking at this ( https://stackoverflow.com/questions/70945720/what-happened-to-cmakes-target-argument ) I am suppose to provide the build directory for cmake like this:

D:\Alembic\alembic-1.8.5>cmake --build ../alembic-1.8.5-build --target install

After this I get an error that I have to use /bigobj compiler option to compile pyalembic, so I added the following lines to the main CMakeLists.txt file:

IF (MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
ENDIF()

then I get linker error for Alembic Tests. So I unchecked USE_TESTS from the CMake-GUI and rebuilt the CMake cache. After that I get another linker error for the debug mode:

fatal error LNK1104: cannot open file 'python38_d.lib'

So I switched to compiling in release mode using

D:\Alembic\alembic-1.8.5>cmake --build ../alembic-1.8.5-build --config Release --target install

This went well, expect when I try to import alembic in python it is still not installed.

D:\Alembic\alembic-1.8.5>python
Python 3.8.10 (tags/v3.8.10:3d8993a, May  3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import alembic
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'alembic'
>>>

Maybe it is my lack of familiarity with Alembic and CMake that is causing some issues, but how can I install it so that I can import alembic under python. Thanks again.

Lucas Miller

unread,
Mar 21, 2023, 12:24:56 PM3/21/23
to alembic-d...@googlegroups.com
Where is your install location?

Could it by that its in a location that is NOT in sys.path?

Lucas

Qtm

unread,
Mar 21, 2023, 12:45:55 PM3/21/23
to alembic-discussion
Python 3.8 is installed using the Windows Store (its path is convoluted, as all Windows App paths are weird), it is installed in:

C:\Users\USERNAME\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe

With its site packages installed in:

C:\Users\USERNAME\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages

Alembic gets installed in C:\Program Files (x86)\Alembic using CMake install.

I see that C:\Program Files (x86)\Alembic\lib\python3.8\site-packages contains alembic.pyd and alembic.lib files, would copying them over to python site-packages solve the issue?

Lucas Miller

unread,
Mar 21, 2023, 12:52:04 PM3/21/23
to alembic-d...@googlegroups.com
What other locations are in your sys.path?

Copying the library over should work, but that path is VERY specific, I wonder if a bit more generic path is included.

Lucas

Qtm

unread,
Mar 21, 2023, 1:28:50 PM3/21/23
to alembic-discussion
Thanks Lucas, I've made some progress. I copied both alembic.pyd and alembic.lib files to 'alembic' folder inside the site packages (with an empty __init__.py file).
Similarly I also copied imath.pyd and imathnumpy.pyd to a new 'imath' folder inside site packages. Now I can import alembic from within python.
However when I try to import alembic.Abc as shown here:

http://docs.alembic.io/python/examples.html#pyalembic-intro

I get the no moudle named alembic.Abc error.

D:\Alembic\pyimath-master>python

Python 3.8.10 (tags/v3.8.10:3d8993a, May  3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from imath import *
>>> from alembic.Abc import *

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'alembic.Abc'
>>>

I'm sure I'm missing something, I'm still not able to import alembic properly.

P.S. I tried to look for a generic path but the specific one is already in my windows Path environment variable.

Lucas Miller

unread,
Mar 21, 2023, 1:34:08 PM3/21/23
to alembic-d...@googlegroups.com
What IS available in alembic?

import alembic
print(dir(alembic))

Lucas

Qtm

unread,
Mar 21, 2023, 1:37:55 PM3/21/23
to alembic-discussion
I get the following:

D:\Alembic\pyimath-master>python
Python 3.8.10 (tags/v3.8.10:3d8993a, May  3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import alembic
>>> print(dir(alembic))
['__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__path__', '__spec__']

Lucas Miller

unread,
Mar 23, 2023, 12:15:37 PM3/23/23
to alembic-d...@googlegroups.com
What version of boost are you using?

There SHOULD be more stuff in that Alembic package, like Abc, etc.

Also why did you choose python 3.8?

I've built it successfully with python 3.7 and boost 1.73   also with python 3.9 and boost 1.76  so I'm hoping this might be a bug with whatever combination you happen to be using.

Lucas
Lucas

Qtm

unread,
Mar 23, 2023, 2:15:29 PM3/23/23
to alembic-discussion
I am using Boost version 1.81.0.

I'm not particular about python 3.8, it is just what I have installed for now. I do think you are right about the particular combination of things I have installed that is causing this issue. 
When I copied IMath pyd files to site packages and tried dir(imath) it also reported as empty, the same as dir(alembic), so there is a problem with the build process and is not particular to Alembic. 
I will try with another version of python, maybe 3.7, to see if that changes things and will report back. Thanks for all your help.

Reply all
Reply to author
Forward
0 new messages