question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ImportError: cannot import name JIRA

See original GitHub issue

I have already done pip install jira

but when I run the following it fails with ImportError: cannot import name JIRA :

import re
from jira import JIRA

jira = JIRA('https://issues.net')
# all values are samples and won't work in your code!
key_cert_data = None
key_cert_file = "cert/jiraprivatekey.pub"
with open(key_cert, 'r') as key_cert_file:
    key_cert_data = key_cert_file.read()

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

65reactions
nirzaricommented, Jan 24, 2018

@kuberkaul It won’t work if your file name is ‘jira.py’ [1] https://stackoverflow.com/questions/41621566/python-cannot-import-name-jira

4reactions
hdostcommented, Jul 12, 2018

@thakkardharmik There are a couple things that could be happening here. A. There is a clashing jira.py B. The python jira module is not installed at all C. The python jira module is not installed for the correct version

Problem A

➜  ~ python
Python 2.7.15 (default, May 16 2018, 17:50:09) 
[GCC 8.1.1 20180502 (Red Hat 8.1.1-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import jira
>>> jira.__file__
'jira.pyc'
>>> quit()

The indicator is that jira.__file__ will show either jira.py or jira.pyc

Solution A Rename your jira.py to something else.

Problem B

➜  ~ python     
Python 2.7.15 (default, May 16 2018, 17:50:09) 
[GCC 8.1.1 20180502 (Red Hat 8.1.1-1)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import jira
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named jira
>>> quit()
➜  ~ python3
Python 3.6.5 (default, Mar 29 2018, 18:20:46) 
[GCC 8.0.1 20180317 (Red Hat 8.0.1-0.19)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import jira
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named jira
>>> quit()

Solution B It’s not actually installed so run python -m pip install jira or python3 -m pip install jira as is appropriate.

Problem C

➜  ~ pip -V      
pip 10.0.1 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)
➜  ~ pip2 -V
pip 9.0.3 from /usr/lib/python2.7/site-packages (python 2.7)
➜  ~ 

Solution C If you did a pip install jira it’s possible that the pip does not match your python. To make sure that you install it to the proper python you can run python -m pip install jira or python3 -m pip install jira

Read more comments on GitHub >

github_iconTop Results From Across the Web

python : cannot import name JIRA - Stack Overflow
fixed it. The file I was running was called jira.py so when I did from. jira import JIRA. It was trying to look...
Read more >
Jira Import error - Atlassian Community
HI,I have done pip install jira==1.0.15 and pip install ... Jira Import error ... ModuleNotFoundError: No module named 'jira'.
Read more >
jira.client - jira 3.4.2.dev7+gf9b84a1 documentation - Python Jira
This module implements a friendly (well, friendlier) interface between the raw JSON responses from Jira and the Resource/dict abstractions provided by this ...
Read more >
[#STORM-3390] Lock python test dependencies so we don't ...
... File "/home/travis/.local/lib/python2.7/site-packages/mock/mock.py", line 69, in <module> from six import wraps ImportError: cannot import name wraps.
Read more >
Jira -Python Error - General - RStudio Community
ImportError: No module named 'jira' from jira.client import JIRA import json import csv options = {'server': 'https://jira.myjira.com/', ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found