I am trying to install nmap package on my mac. After I had completed the installation process described on the developer's site I tried to run the following code:
import nmap
def nmapScan(tgtHost, tgtPort):
nmScan = nmap.PortScanner()
So I got an error:
File "build/bdist.macosx-10.10-intel/egg/nmap/nmap.py", line 180, in __init__
nmap.nmap.PortScannerError: 'nmap program was not found in path. PATH is :/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin'
Ok. I found the path to python-nmap package and added it manually to the PATH. I believe that I have to add one that contains nmap.py file. Here it is:
/Users/%username%/Documents/Python_docs/python-nmap-0.1.4/nmap
And I am still getting the same error. Does anyone know why? Is there someone else who had this problem before? I have searched through internet and there is nothing that helps me. Thank you!
You need to install the nmap first. Use this link nmap. Since the Python library invokes the nmap binary. nmap binary should be available in your system.
Install nmap with homebrew and this error goes away.
brew install nmap
You can do this before or after you install python-nmap.
Related
I am running 64-bit Windows 7, python 3.7.
I used pip install pyodbc and it installed pyodbc-4.0.28.dist-info version in the following directory in my pc: C:\Users\Owner\AppData\Local\Programs\Python\Python37\Lib\site-packages.
Since I got the following warning - import pyodbc ImportError: DLL load failed: the specified module could not be found - so I used the sys.path to find out whether the path to it was there or not and it was>
C:\Users\Propietario\AppData\Local\Programs\Python\Python37\Lib\idlelib
C:\Users\Propietario\Python Scripts
C:\xampp\htdocs\Python Scripts
C:\Users\Propietario\AppData\Local\Programs\Python\Python37\python37.zip
C:\Users\Propietario\AppData\Local\Programs\Python\Python37\DLLs
C:\Users\Propietario\AppData\Local\Programs\Python\Python37\lib
C:\Users\Propietario\AppData\Local\Programs\Python\Python37
**C:\Users\Propietario\AppData\Local\Programs\Python\Python37\lib\site-packages**
As it can be seen the path to the directory is included in the PATH variable.
I'm wondering if the problem is the directory's name? it's not pyodbc, but pyodbc-4.0.28.dist-info
By the way, pip uninstall pyodbc had no problem finding it
Uninstalling pyodbc-4.0.28:
Would remove:
c:\users\Owner\appdata\local\programs\python\python37\lib\site-package
s\pyodbc-4.0.28.dist-info*
c:\users\Owner\appdata\local\programs\python\python37\lib\site-package
s\pyodbc.cp37-win_amd64.pyd
Proceed (y/n)? y
Successfully uninstalled pyodbc-4.0.28
Does anyone have any idea about it. What can I do to solve the problem
Thanks in adavance
it's not you. it failed for me too. on a mac.
so doing a little digging - it's an outstanding issue -
https://github.com/mkleehammer/pyodbc/issues/677
https://github.com/mkleehammer/pyodbc/issues/663
return import("pyodbc") ImportError: DLL load failed: The specified module could not be found
the solution is "I am also encountering the same problem with pyodbc 4.0.28 while with 4.0.27 everything works as intended." Tatu Leinonen copyrite
I did not face issue with python but with maven. My observation is:
Some time there are issues with Get-Item -Path command or SETX PATH in PowerShell. You could try to set path variable through this script (run as admin) and try.
$existingpath = $env:Path
$newpath = $existingpath + ';' + '<Your Path>'
[System.Environment]::SetEnvironmentVariable('Path', $newpath, [System.EnvironmentVariableTarget]::Machine )
As a # ShpielMeister said, there's an issue with pyodbc version 4.0.28, so I decided to go with version 4.0.27 for now.
So for those of you who are new to python and pyodbc like me, the following code is the way to get a specific version:
pip install pyodbc==4.0.27
This version works just fine for me.
When I try to upload an app to the app store I get the following error:
Stripping extended attributes failed.
"/usr/bin/xattr -crs /var/folders/t2/fjp18t212bdc6kgb3pjzk81m0000gn/T/XcodeDistPipeline.ZBT/Root/Payload/testvgd.app" exited with a non-zero status. The /usr/bin/xattr tool may be damaged.
When I try to run this tool /usr/bin/xattr from command-line I get:
"pkg_resources.DistributionNotFound: The 'xattr==0.6.4' distribution was not found and is required by the application"
Where and how can I add this xattr distribution? I downloaded it from: https://pypi.python.org/pypi/xattr/0.6.4, but when I try to install this, I get: error: package directory 'xattr' does not exist.
Is there a fix or workaround for this? Thanks!
I was afraid I had to clean re-install of Mac, however: an update of MacOS was enough to solve the error in xattr
I hope I save someone the trouble of a clean install with this answer :)
I restart the MAC computer solved the problem.
I'm trying to create a pdf file inside a python/django project. I'm using PyLatex, which helps, but it's generate_pdf method breaks when it calls pdflatex. I keep getting this error:
FileNotFoundError: [Errno 2] No such file or directory: 'pdflatex'
I tried everything - os.system() ... subprocess. Any way I try, it can't find pdflatex. I'm running on Windows, but I need to be able to to do this within the web-app anyway.
Thanks for any help!
You just need to install pdflatex (and you will need to install on your server when you release your web-app). Instructions for installing on windows can be found in the top answer here.
Do you have "pdflatex" installed? As per this question, you may have to install "MiKTeX" and point os.system() at C:\Program Files\MiKTeX <MikTeX version>\miktex\bin to make it work.
Hope that helps.
Do you have texlive installed? If yes, then the issue is with the system path variable. If not already added, add it to the system path.
#
Updated answer:
I took the time and decided to replicate your issue. I too use windows.
I copied the basic example from Pylatex and tested it on my machine, I was able to replicate the same error as you despite having TexLive installed. To solve it I did the following steps:
Installed MikTex (I believe you have it installed).
Tried running it again but failed with the error missing package latexmk.
Using MikTex package manager, I installed the latexmk package.
Tried running but still failed, error missing perl.exe command.
I had to install perl to my windows, use the following links -- https://learn.perl.org/installing/windows.html
When I tried again, it compiled successfully.
The issue was not having the package latexmk for MikTex and perl.exe of which you should have posted as part of the error logs. Try that and let me know if successful.
From IDLE, I tried to run a script with a newly installed scrapy 1.0.3.
I'm using a script from a friend whom it worked for (but on Windows, I'm on a Mac).
From the import of scrapy on the first line, I get this error when running the program:
ImportError: No module named twisted.persisted.styles
The whole script, if it's helpful, points to this:
Traceback (most recent call last):
File "/Users/eliasfong/tutorial/tutorial/spiders/medspider.py", line 1, in <module>
import scrapy
File "/Library/Python/2.7/site-packages/scrapy/__init__.py", line 27, in <module>
from . import _monkeypatches
File "/Library/Python/2.7/site-packages/scrapy/_monkeypatches.py", line 20, in <module>
import twisted.persisted.styles # NOQA
ImportError: No module named twisted.persisted.styles
Any suggestions on how to tackle this problem?
Just try to force the update of twisted :
pip install twisted --upgrade
That works for me with python3.4 and Scrapy==1.1.0rc1
Either twisted is installed on your mac (I highly doubt it since it's not a standard library) and for whatever reason the IDE (i'm assuming that's what you mean since you typed "idle") or the terminal you are in doesn't have your updated environment variables, meaning it doesn't understand where your default python libraries are (again I highly doubt it), or you simple do not have twisted installed on your mac. If it's not installed you have a couple of options:
The easiest way to install a python package is through pip.
If that not an option you can try homebrew which is another package manager for macs. It offers an easy way to install packages correctly.
If that still is not an option for you or you simply don't want to attempt that you can download twisted directly from here (the .bz2 since you're on a mac), click on it and it should unzip it for you. Then just run setup.py and it should install it in the correct location on your mac.
If that still doesn't work and you have decent knowledge of unix. Use the "locate" command on the terminal and find out where your dist-packages directory is and put the source for twisted in there directly and then attempt to import twisted in your IDE or in the python interpreter to verify that it is installed.
note: If you're still having problems after it is installed trying restarting your IDE or messing with some setting to make sure your IDE has the right environment and python path. Hope that helps!
It could be related to having installed Python without bzip2. I had the same error and this helped me, see the accepted answer here:
Installing Twisted through pip broken on one server
Had this exact thing on FreeBSD. Solution (as root/sudo):
chmod -R go+rX /usr/local/lib/python2.7/site-packages
Some directory permissions weren't set up right on install.
I am using Ubuntu and virtualenv, and I am having this recurring problem, while attempting to use Fabric to create a deployment script. Fabric depends on paramiko, which depends on PyCrypto.
Each time I try to use Fabric, or PyCrypto directly, I get this error:
ImportError: cannot import name Random
I have tried reinstalling with pip install -U PyCrypto. I have also tried installing the python-crypto and python-crypto-dbg packages with Aptitude, to no avail. I still get the same error. Anyone have any ideas that might help me solve this problem? Thanks in advance!
It's possible that there's a file name collision in your the directory from which you're running Fabric. Do you have a file called Crypto.py in your project?
Can you get Crypto.Random to import from outside of your project directory? (but still using your virtualenv. Ipython is a big help here.)
I've had the same trouble in the past using Ubuntu. I no longer have a Ubuntu install available, but on my old 10.04 box, the file Random in the Crypto directory was missing. Make sure it exists, if it doesn't, that's the problem.