DiamondLightSource / cothread

Cooperative Python Threads and EPICS Channel Access bindings
Apache License 2.0
13 stars 9 forks source link

pip3 installs wrong version of cothread #3

Closed femanov closed 6 years ago

femanov commented 8 years ago

my install is listed bellow. there is an error. I am using python3.4/ubuntu 15.10 for this.

pip3 install cothread

Downloading/unpacking cothread Downloading cothread-2.13.1.tar.gz (91kB): 91kB downloaded Running setup.py (path:/tmp/pip-build-3fuqihnb/cothread/setup.py) egg_info for package cothread

Requirement already satisfied (use --upgrade to upgrade): numpy in /usr/local/lib/python3.4/dist-packages (from cothread) Installing collected packages: cothread Running setup.py install for cothread building 'cothread._coroutine' extension x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.4m -c context/_coroutine.c -o build/temp.linux-x86_64-3.4/context/_coroutine.o -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wundef -Wshadow -Wcast-align -Wwrite-strings -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes In file included from /usr/include/python3.4m/Python.h:53:0, from context/_coroutine.c:33: context/_coroutine.c: In function ‘coroutine_switch’: /usr/include/python3.4m/pyatomic.h:117:40: warning: declaration of ‘result’ shadows a previous local [-Wshadow] typeof(atomic_val->_value) result; \ ^ /usr/include/python3.4m/pyatomic.h:177:5: note: in expansion of macro ‘_Py_atomic_load_explicit’ _Py_atomic_load_explicit(ATOMIC_VAL, _Py_memory_order_relaxed) ^ /usr/include/python3.4m/pystate.h:186:22: note: in expansion of macro ‘_Py_atomic_load_relaxed’ ((PyThreadState)_Py_atomic_load_relaxed(&_PyThreadState_Current)) ^ context/_coroutine.c:137:24: note: in expansion of macro ‘PyThreadState_GET’ thread_state = PyThreadState_GET(); ^ context/_coroutine.c:133:19: note: shadowed declaration is here PyObject result = switch_cocore(target, arg); ^ x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.4m -c context/cocore.c -o build/temp.linux-x86_64-3.4/context/cocore.o -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wundef -Wshadow -Wcast-align -Wwrite-strings -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.4m -c context/switch.c -o build/temp.linux-x86_64-3.4/context/switch.o -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Wundef -Wshadow -Wcast-align -Wwrite-strings -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.4/context/_coroutine.o build/temp.linux-x86_64-3.4/context/cocore.o build/temp.linux-x86_64-3.4/context/switch.o -o build/lib.linux-x86_64-3.4/cothread/_coroutine.cpython-34m.so File "/usr/local/lib/python3.4/dist-packages/cothread/cothread.py", line 705 raise result[0], result[1], result[2] ^ SyntaxError: invalid syntax

Installing pvtree.py script to /usr/local/bin

Successfully installed cothread Cleaning up...

Araneidae commented 8 years ago

Yes, this is a problem ... actually several problems at once!

The biggest problem is that pip3 is trying to install cothread-2.13.1 under Python 3. Unfortunately this is the Python 2 version of cothread, and it just won't work with Python 3.

Instead you need to install v2-13-Python3, but I think you'll need to download the sources directly from the tag and run the setup script directly -- we haven't configured pip to manage different versions for the two Python versions (and to be honest we don't know how to yet).

My advice is to download https://github.com/dls-controls/cothread/archive/v2-13-Python3.tar.gz , untar it, and run python3 setup.py install ... don't forget to uninstall the failed install first!

Araneidae commented 8 years ago

Do let me know if you still get any build warnings when installing manually.

femanov commented 8 years ago

Hi,

I tried it, after sucsessful build and install module is not working under

my python3:

princess% python3 Python 3.5.1+ (default, Mar 30 2016, 22:46:26) [GCC 5.3.1 20160330] on linux Type "help", "copyright", "credits" or "license" for more information.

import cothread Traceback (most recent call last): File "", line 1, in File "/home/femanov/soft/cothread-2-13-Python3/cothread/init.py", line 41, in from . import cothread File "/home/femanov/soft/cothread-2-13-Python3/cothread/cothread.py", line 78, in from . import _coroutine ImportError: cannot import name '_coroutine'


I think the best way is to make the same code working under python 2 and 3. I know, sometimes it isn't possible. if you already have different versions, may be you need to use different package names?

Thank you. Fedor Emanov.

On Thu, Apr 21, 2016 at 3:34 PM, Michael Abbott notifications@github.com wrote:

Yes, this is a problem ... actually several problems at once!

The biggest problem is that pip3 is trying to install cothread-2.13.1 under Python 3. Unfortunately this is the Python 2 version of cothread, and it just won't work with Python 3.

Instead you need to install v2-13-Python3, but I think you'll need to download the sources directly from the tag and run the setup script directly -- we haven't configured pip to manage different versions for the two Python versions (and to be honest we don't know how to yet).

My advice is to download https://github.com/dls-controls/cothread/archive/v2-13-Python3.tar.gz , untar it, and run python3 setup.py install ... don't forget to uninstall the failed install first!

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/dls-controls/cothread/issues/3#issuecomment-212830646

femanov commented 8 years ago

there is file _coroutine.py in installed module dir, if this file removed, module is imported sucessfully.

On Wed, Jun 1, 2016 at 12:22 PM, Fedor Emanov femanov@gmail.com wrote:

Hi,

I tried it, after sucsessful build and install module is not working under

my python3:

princess% python3 Python 3.5.1+ (default, Mar 30 2016, 22:46:26) [GCC 5.3.1 20160330] on linux Type "help", "copyright", "credits" or "license" for more information.

import cothread Traceback (most recent call last): File "", line 1, in File "/home/femanov/soft/cothread-2-13-Python3/cothread/init.py", line 41, in from . import cothread File "/home/femanov/soft/cothread-2-13-Python3/cothread/cothread.py", line 78, in from . import _coroutine ImportError: cannot import name '_coroutine'


I think the best way is to make the same code working under python 2 and

  1. I know, sometimes it isn't possible. if you already have different versions, may be you need to use different package names?

Thank you. Fedor Emanov.

On Thu, Apr 21, 2016 at 3:34 PM, Michael Abbott notifications@github.com wrote:

Yes, this is a problem ... actually several problems at once!

The biggest problem is that pip3 is trying to install cothread-2.13.1 under Python 3. Unfortunately this is the Python 2 version of cothread, and it just won't work with Python 3.

Instead you need to install v2-13-Python3, but I think you'll need to download the sources directly from the tag and run the setup script directly -- we haven't configured pip to manage different versions for the two Python versions (and to be honest we don't know how to yet).

My advice is to download https://github.com/dls-controls/cothread/archive/v2-13-Python3.tar.gz , untar it, and run python3 setup.py install ... don't forget to uninstall the failed install first!

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/dls-controls/cothread/issues/3#issuecomment-212830646

Araneidae commented 6 years ago

@thomascobb , do you have any thoughts on this issue? I know you've been looking after the Pip stuff, and maybe after our 2+3 merge everything should work properly now?

thomascobb commented 6 years ago

It seems to work now.

With a Python3 install, doing pip install cothread gets 2.14 and seems to do the right thing