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 'SecureHeaders' from 'secure'

See original GitHub issue

**Please provide a description of the issue and any relevant error messages.

I follow these instructions to install spiderfoot on Debian 10 https://www.howtoforge.com/how-to-install-spiderfoot-on-ubuntu-20-04/

However, whenever I run:

python3 sf.py --help

I get:

# python3 sf.py --help
Traceback (most recent call last):
  File "sf.py", line 32, in <module>
    from sfwebui import SpiderFootWebUi
  File "/root/python-environments/spiderfoot-3.3/sfwebui.py", line 27, in <module>
    from secure import SecureHeaders
ImportError: cannot import name 'SecureHeaders' from 'secure' (/root/python-environments/spiderfoot-env/lib/python3.7/site-packages/secure/__init__.py)

**What version of Python are you using?

I have python 2.7 and 3.7 installed. I am using python 3.7 in a virtual environment to install.

My Steps:

#pip3 install --upgrade pip
#pip3 install wheel
#wget https://github.com/smicallef/spiderfoot/archive/v3.3.tar.gz
#tar -xvzf v3.3.tar.gz
#cd spiderfoot-3.3
#pip3 install -r requirements.txt
#python3 sf.py --help

ERROR (see above)

I tried with secure-0.2.1 in the requirements.txt I tried again after editing requirements.txt to use secure-0.3.0, but same error

**What version of SpiderFoot are you using (stable release or Git master branch)?

https://github.com/smicallef/spiderfoot/archive/v3.3.tar.gz

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
yupthatguycommented, May 15, 2021

Hey hey, thanks for the help. Turns out that the requirements.txt that I downloaded with: wget https://github.com/smicallef/spiderfoot/archive/v3.3.tar.gz is simply incorrect.

Just before before I ran:

pip3 install -r requirements.txt

I first made a backup of the requirements.txt -> requirements.txt.bak Then, I made a new requirements.txt file and copy & pasted your content from: https://github.com/smicallef/spiderfoot/blob/master/requirements.txt Sure, enough I was able to complete the install without any further problems.

FYI I ran a quick diff check of requirements.txt (yours) and requirements.txt.bak (the original downloaded in the tar.gz), it showed several lines are different and were causing my headache:

diff requirements.txt requirements.txt.bak
8c8
< lxml>=4.6.3
---
> lxml>=4.6.2
19c19
< secure>=0.2.1,<0.3.0
---
> secure>=0.2.1
24c24
< cryptography>=3.3.2
---
> cryptography>=3.3.0

The installation went smoothly, so we can close this issued as solved. A new issue arose when trying to run spiderfoot on my prod server, but I will research a bit, and open a new issue, if I can’t crack it.

thanks

0reactions
Sd0bcommented, Feb 1, 2022

#On Ubuntu 20.10 The tool works After pip3 install secure==0.2.1 And pip3 install networkx==2.5

This resolve both : cannot import name 'nx' from 'networkx' cannot import name 'SecureHeaders' from 'secure'

Read more comments on GitHub >

github_iconTop Results From Across the Web

cannot import name 'SecureHeaders' from 'secure'
ImportError : cannot import name 'SecureHeaders' from 'secure'
Read more >
ImportError: cannot import name 'secure_filename' - ...
For Werkzeug version 2.1.2, just import secure_filename as: from werkzeug.utils import secure_filename.
Read more >
Python Friday #43: Add Security Headers to Your Flask ...
Today we look at a first simple measure to add security headers. This post is part of my journey to ... from secure...
Read more >
[Solved] ImportError: Cannot Import Name - Python Pool
ImportError : Cannot Import Name: In this article, we will see what are the reasons for importerror cannot import name and find its...
Read more >
How to Download, Install, and Setup Tensorflow on ...
Invicti Web Application Security Scanner - the only solution that delivers ... “ImportError: DLL load failed: The specified module could not be found.“:....
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