From: Stipe Mustać (stipe.mustac_at_pharma.unizg.hr)
Date: Wed Jan 22 2025 - 12:46:33 CST

Dear Josh,

Thanks for your help (and after some additional struggles) I finally
managed to compile the vmd with python interpreter. I didn't install any
programs listed in the documentation as dependencies (surf, stride,
tachyon) but the software seems to run normally?

I tried to compile vmd-python by Robin Betz, but i have some other
compilation errors too which for now I can't solve. Should I open a new
topic or can I go on here with that compilation error here? I also don't
understand what are the advantages of vmd-python over just using vmd
with python interpreter regularly?

Thank you very much once again, I would never be able to solve this
struggle without your assistance.
Sincerely,
Stipe

On 1/21/25 8:04 PM, Josh Vermaas wrote:
> Hi Stipe,
>
> Lets try to keep this in VMD-L, so that future googlers can figure out
> what the problem was. I think this is more of the same. Looks like you
> are using python 3.13, while my Ubuntu machine uses 3.12. The key line
> from your logs are these:
>
> PythonTextInterp.C:105:24: error: ‘PyEval_CallObject’ was not declared
> in this scope; did you mean ‘PyObject_CallObject’?
> PythonTextInterp.C:177:3: error: ‘PySys_AddWarnOption’ was not
> declared in this scope; did you mean ‘PySys_ResetWarnOptions’?
>
> For what I am sure are good reasons, occasionally python deprecates
> parts of their API. In this case, VMD is depending on
> PyEval_CallObject and PySys_AddWarnOption. PyEval_CallObject was
> deprecated in 3.9, and was removed as of 3.13, which is why you are
> running into issues compiling it. Based on a bit of googling, it looks
> like you just use PyObject_CallObject instead.
>
> For AddWarnOption it looks like the API changed pretty drastically.
> I'm not actually sure what happens if we have no warn options, so you
> may want to consider just exempting python 3.13 and higher from
> AddWarnOption, as we just add the defaults anyway. So something like this:
>
> #if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION <= 12
>   PySys_AddWarnOption(L"default");
> #elif PY_MAJOR_VERSION < 3
>   PySys_AddWarnOption((char*) "default");
> #endif
>
> I know Diego has been working quite a bit on a "VMD 2.0" that
> hopefully has all these deprecations taken care of.
>
> -Josh
>
>
> On 1/21/25 12:39 PM, Stipe Mustać wrote:
>>
>> Hi Josh,
>>
>> I changed the mentioned lines and the compilation finished without
>> reporting any errors. Then I went on to compile vmd, and got the
>> following:
>>
>> Compiling  PythonTextInterp.C  -->  PythonTextInterp.o ...
>> PythonTextInterp.C: In function ‘void call_callbacks(const char*,
>> PyObject*)’:
>> PythonTextInterp.C:105:24: error: ‘PyEval_CallObject’ was not
>> declared in this scope; did you mean ‘PyObject_CallObject’?
>>   105 |     PyObject *result = PyEval_CallObject(obj, arglist);
>>       |                        ^~~~~~~~~~~~~~~~~
>>       |                        PyObject_CallObject
>> PythonTextInterp.C: In constructor
>> ‘PythonTextInterp::PythonTextInterp(VMDApp*)’:
>> PythonTextInterp.C:177:3: error: ‘PySys_AddWarnOption’ was not
>> declared in this scope; did you mean ‘PySys_ResetWarnOptions’?
>>   177 |   PySys_AddWarnOption(L"default");
>>       |   ^~~~~~~~~~~~~~~~~~~
>>       |   PySys_ResetWarnOptions
>> PythonTextInterp.C:199:16: warning: ‘void PySys_SetArgv(int,
>> wchar_t**)’ is deprecated [-Wdeprecated-declarations]
>>   199 |   PySys_SetArgv(argc, wargv);
>>       |   ~~~~~~~~~~~~~^~~~~~~~~~~~~
>> In file included from /usr/include/python3.13/Python.h:125,
>>                  from py_commands.h:24,
>>                  from PythonTextInterp.C:21:
>> /usr/include/python3.13/sysmodule.h:10:38: note: declared here
>>    10 | Py_DEPRECATED(3.11) PyAPI_FUNC(void) PySys_SetArgv(int,
>> wchar_t **);
>>       |                                      ^~~~~~~~~~~~~
>> make: *** [Makefile:621: PythonTextInterp.o] Error 1
>>
>> I am not sure if i provided the right directories as libraries or is
>> it really some python syntax problem? Log file again in attachment.
>>
>> Thank you very much once again for your assistance.
>>
>> Stipe
>>
>> On 1/21/25 5:53 PM, Josh Vermaas wrote:
>>> Hi Stipe,
>>>
>>> Based on the log you attached, you want to look for compiler errors.
>>> I see this in the log you attached:
>>>
>>> src/qcschemaplugin.c: In function ‘open_qcschema_read’:
>>> src/qcschemaplugin.c:162:29: error: assignment to ‘int’ from ‘struct
>>> _json_value *’ makes integer from pointer without a cast
>>> [-Wint-conversion]
>>>   162 |           data->totalcharge =
>>> aux_value->u.object.values[j].value;
>>>       |                             ^
>>> src/qcschemaplugin.c:165:30: error: assignment to ‘int’ from ‘struct
>>> _json_value *’ makes integer from pointer without a cast
>>> [-Wint-conversion]
>>>   165 |           data->multiplicity =
>>> aux_value->u.object.values[j].value;
>>>
>>> To me, this looks like your compiler is pickier than mine, and is
>>> treating something that used to be a warning into a full-blown
>>> error. See https://urldefense.com/v3/__https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106416__;!!DZ3fjg!5FHzW5pqi7xgRmkqydjWyOwfssGs_HLSCFEqnufq3wsJUqTFzKJvWpHCEiyagCJaP9RNMKEsh9BhxX032uvM6SrKaKcnXN0$ which
>>> makes this look like the intended behavior nowadays, which is
>>> unfortunate since this particular plugin hasn't been changed in
>>> YEARS. I think you could make the compiler happy by adding in the
>>> cast there:
>>>
>>> data->totalcharge = (int) aux_value->u.object.values[j].value;
>>> data->multiplicity = (int) aux_value->u.object.values[j].value;
>>>
>>> Or alternatively changing the compiler flags to make that error a
>>> warning again.
>>>
>>> -Josh
>>>
>>>
>>> On 1/21/25 11:18 AM, Stipe Mustać wrote:
>>>> Hello Josh!
>>>>
>>>> Thank you very much for the links you provided. I used them all and
>>>> I can compile nothing. Neither vmd nor vmd-python. I actually
>>>> realized later i have to compile vmd from source and that is what i
>>>> am trying to do the entire day today. I was mostly referring to the
>>>> guide posted by Robin Betz. Unfortunately I can‘t even compile the
>>>> plugins. The error I get when compiling plugins is:
>>>>
>>>> make[2]: *** [Makefile:556:
>>>> ../compile/lib_LINUXAMD64/molfile/qcschemaplugin.o] Error 1
>>>> make[2]: Leaving directory
>>>> '/home/stipe/downloads/vmdpackaging/plugins/molfile_plugin'
>>>> make[1]: *** [Makefile:164: molfilelibs] Error 1
>>>> make[1]: Leaving directory '/home/stipe/downloads/vmdpackaging/plugins'
>>>> make: *** [Make-arch:338: LINUXAMD64] Error 2
>>>>
>>>> I applied that sed command you provided in your guide to switch
>>>> from tcl 8.5 to 8.6. I am sending the entire make output in the
>>>> attachment. I haven’t still installed surf, stride or tachyon. My
>>>> os is arch linux and it uses python 3.13.
>>>>
>>>> Thank you once again.
>>>> Sincerely,
>>>> Stipe Mustac
>>>>
>>>>
>>>> > Am 21.01.2025 um 16:23 schrieb Josh Vermaas <vermaasj_at_msu.edu>:
>>>> >
>>>> > Hi Stipe,
>>>> >
>>>> > How did you install VMD? The default VMD installations that you
>>>> can download from the ks.uiuc.edu website don't come with a python
>>>> interpreter built-in. Instead, if you want python and graphics, you
>>>> end up needing to compile VMD yourself.
>>>> https://urldefense.com/v3/__https://robinbetz.com/blog/2015/01/08/compiling-vmd-with-python-support/__;!!DZ3fjg!5Cp0UHc8gqyWY_z16AWli_FiYQKIyw3BouVGyNUkt9XAZL4zSZdjwo-vEOH5HAHnuSGU33rJAEKLeSGKjP8$
>>>> has a blogpost describing the process, and she's also got a way of
>>>> installing VMD as a python package
>>>> (https://urldefense.com/v3/__https://vmd.robinbetz.com/__;!!DZ3fjg!5Cp0UHc8gqyWY_z16AWli_FiYQKIyw3BouVGyNUkt9XAZL4zSZdjwo-vEOH5HAHnuSGU33rJAEKLw_8HEtI$
>>>> ). I've got packaging instructions for alpha versions of VMD that I
>>>> use within my lab as well.
>>>> https://urldefense.com/v3/__https://github.com/jvermaas/vmd-packaging-instructions__;!!DZ3fjg!5Cp0UHc8gqyWY_z16AWli_FiYQKIyw3BouVGyNUkt9XAZL4zSZdjwo-vEOH5HAHnuSGU33rJAEKL8qbMb2s$
>>>> > Hope this helps!
>>>> >
>>>> > -Josh
>>>> >
>>>> >
>>>> >> On 1/20/25 2:18 PM, Stipe Mustać wrote:
>>>> >> Hello! I am trying to use python interpreter in vmd. The error
>>>> message I keep getting is:
>>>> >>
>>>> >> Info) Starting Python...
>>>> >> 'import site' failed; use -v for traceback
>>>> >> rlwrap: warning: vmd crashed, killed by SIGSEGV (core dumped).
>>>> >> rlwrap itself has not crashed, but for transparency,
>>>> >> it will now kill itself with the same signal
>>>> >>
>>>> >> warnings can be silenced by the --no-warnings (-n) option
>>>> >> Segmentation fault (core dumped)
>>>> >>
>>>> >> I saw a person who posted in this mailing list having the same
>>>> issue in 2023, tried to reproduce all the tutorials and guides, but
>>>> without any success. I would appreciate any help.
>>>> >>
>>>> >> Sincerely,
>>>> >> Stipe Mustac
>>>> >>
>>>> >
>>>> > --
>>>> > Josh Vermaas
>>>> >
>>>> > vermaasj_at_msu.edu
>>>> > Assistant Professor, Plant Research Laboratory and Biochemistry
>>>> and Molecular Biology
>>>> > Michigan State University
>>>> > vermaaslab.github.io
>>>> >
>>>> >
>>>
>>> --
>>> Josh Vermaas
>>>
>>> vermaasj_at_msu.edu
>>> Assistant Professor, Plant Research Laboratory and Biochemistry and Molecular Biology
>>> Michigan State University
>>> vermaaslab.github.io
>
> --
> Josh Vermaas
>
> vermaasj_at_msu.edu
> Assistant Professor, Plant Research Laboratory and Biochemistry and Molecular Biology
> Michigan State University
> vermaaslab.github.io