ImportError: cannot import name find_spec when deploying to openshift

513 views Asked by At

I'm trying to deploy my Django project at openshift using Python 3.3 (because my project is made only for python3). Here we found an error ImportError: cannot import name find_spec when I check the log file.

[Wed Jul 19 10:53:25 2017] [error] [client 127.2.83.1] from django.utils.module_loading import import_string
[Wed Jul 19 10:53:25 2017] [error] [client 127.2.83.1] File "/var/lib/openshift/596f5f3822s71edsf000ad/python/virtenv/venv/lib/python3.3/site-packages/django/utils/module_loading.py", line 67, in <module>
[Wed Jul 19 10:53:25 2017] [error] [client 127.2.83.1] from importlib.util import find_spec as importlib_find
[Wed Jul 19 10:53:25 2017] [error] [client 127.2.83.1] ImportError: cannot import name find_spec

As following these issues https://stackoverflow.com/a/34648720/6396981 and https://code.djangoproject.com/ticket/25868. Django recommended to upgrade my Python, but in this case openshift is only available for python 3.3.2.

[myapp-foobar.rhcloud.com 596f5f3822s71edsf000ad]\> python
Python 3.3.2 (default, Aug  5 2016, 06:46:58) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-9)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

When I check at the cartridges, Python 3.5 isn't available:

➜  openshift git:(openshift) rhc app create
When creating an application, you must provide a name and a cartridge from the list below:

Short Name           Full name
==========           =========
diy-0.1              Do-It-Yourself 0.1
jbossas-7            JBoss Application Server 7
jboss-dv-6.1.0       JBoss Data Virtualization 6
jbosseap-6           JBoss Enterprise Application Platform 6
jboss-unified-push-1 JBoss Unified Push Server 1.0.0.Beta1
jboss-unified-push-2 JBoss Unified Push Server 1.0.0.Beta2
jenkins-1            Jenkins Server
nodejs-0.10          Node.js 0.10
perl-5.10            Perl 5.10
php-5.3              PHP 5.3
php-5.4              PHP 5.4
zend-6.1             PHP 5.4 with Zend Server 6.1
python-2.6           Python 2.6
python-2.7           Python 2.7
python-3.3           Python 3.3
ruby-1.8             Ruby 1.8
ruby-1.9             Ruby 1.9
ruby-2.0             Ruby 2.0
jbossews-1.0         Tomcat 6 (JBoss EWS 1.0)
jbossews-2.0         Tomcat 7 (JBoss EWS 2.0)
jboss-vertx-2.1      Vert.x 2.1
jboss-wildfly-10     WildFly Application Server 10
jboss-wildfly-8      WildFly Application Server 8.2.1.Final
jboss-wildfly-9      WildFly Application Server 9

Any idea to handle this? Something like upgrading that python version into Python 3.5 or anything?

0

There are 0 answers