Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3 linking problem #33

Closed
lfdmotta opened this issue Dec 22, 2016 · 3 comments
Closed

Python 3 linking problem #33

lfdmotta opened this issue Dec 22, 2016 · 3 comments

Comments

@lfdmotta
Copy link

Hi,

I tried the following to install SnakeCharmR set to use Python 3:
install.packages("SnakeCharmR", configure.vars = "SNAKECHARMR_PYTHON_VERSION=3.5")

This gives the following error:

python.cpp:50:19: error: use of undeclared identifier 'PyString_AS_STRING'
String retval(PyString_AS_STRING(PyUnicode_AsUTF8String(value)), CE_UTF8);
^
python.cpp:56:14: error: use of undeclared identifier 'PyString_Check'; did you mean 'PyMapping_Check'?
} else if (PyString_Check(value))
^~~~~~~~~~~~~~
PyMapping_Check
/Library/Frameworks/Python.framework/Versions/3.5/include/python3.5m/abstract.h:1152:22: note: 'PyMapping_Check' declared here
PyAPI_FUNC(int) PyMapping_Check(PyObject *o);
^
python.cpp:57:19: error: use of undeclared identifier 'PyString_AS_STRING'
return String(PyString_AS_STRING(value));
^
3 errors generated.

Apparently PyString_ are no longer available in Python 3 API:

https://docs.python.org/3/howto/cporting.html?highlight=pystring

Perhaps pyBytes_Check should be used instead?

@asieira
Copy link
Owner

asieira commented Mar 13, 2017

Funny that the documentation mentions this, but that does not seem to work:

Python 2.6 and later provide a compatibility header, bytesobject.h, mapping PyBytes names to PyString ones.

I have been able to replicate the problem and will attempt a fix shortly. Thank you for reporting this.

asieira added a commit that referenced this issue Mar 13, 2017
Fixed compilation on Python 3, fixing
#33. Thanks to
https://github.com/lfdmotta for reporting this.

Updated Travis tests to cover Python 2 and 3, and also to cover all
major versions of R.
asieira added a commit that referenced this issue Mar 14, 2017
* Python 3 linking and tests (#33)

Fixed compilation on Python 3, fixing
#33. Thanks to
https://github.com/lfdmotta for reporting this.

Updated Travis tests to cover Python 2 and 3, and also to cover all
major versions of R.

* Updates to travis config

* More Travis and startup message improvements

* Simpler Travis config for homebrew packages

* Fix to Travis homebrew packages

* More Travis updates

* Fix to R check warning

As per contact from CRAN staff regarding submission of version 1.0.5:
```
* checking compiled code ... NOTE
File ‘SnakeCharmR/libs/SnakeCharmR.so’:
Found no calls to: ‘R_registerRoutines’, ‘R_useDynamicSymbols’
```
@asieira
Copy link
Owner

asieira commented Mar 14, 2017

I have merged the fix to master, you can use devtools::install_github to install directly from here and confirm that this has worked.

@asieira asieira closed this as completed Mar 14, 2017
@asieira
Copy link
Owner

asieira commented Mar 31, 2017

Just wanted to let you know SnakeCharmR 1.0.6 is on CRAN now, and it fixes this problem. Thanks again for reporting this. 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants