I am using windows 8 and python 3.6.1 I've done the following command in my cmd:
pip install cryptoshop
However, when I run the following python code:
from cryptoshop import encryptfile
from cryptoshop import decryptfile
result1 = encryptfile(filename="test", passphrase="mypassphrase", algo="srp")
print(result1)
result2 = decryptfile(filename="test.cryptoshop", passphrase="mypassphrase")
print(result2)
I get the following error:
Traceback (most recent call last):
File "C:/Users/Owner/Desktop/test.py", line 1, in
from cryptoshop import encryptfile
File "C:\Users\Owner\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cryptoshop__init__.py", line 26, in
from cryptoshop.cryptoshop import encryptfile
File "C:\Users\Owner\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cryptoshop\cryptoshop.py", line 56, in
from ._cascade_engine import encry_decry_cascade
File "C:\Users\Owner\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cryptoshop_cascade_engine.py", line 27, in
from ._nonce_engine import generate_nonce_timestamp
File "C:\Users\Owner\AppData\Local\Programs\Python\Python36-32\lib\site-packages\cryptoshop_nonce_engine.py", line 39, in
import botan
ModuleNotFoundError: No module named 'botan'
Now, I obviously know that you must install botan into python in order to use it. However, this is where I am running into an issue. I've downloaded Botan from this link as instructed:
https://github.com/randombit/botan
And then I've followed these instructions in an attempt to install Botan:
./configure.py [--prefix=/some/directory]
make
make install
However, when I type make into the command line I get an error saying there is no such command. And then when I go to run my above Python code I still get the no module Botan error. So obviously I am doing something run. How can I properly install Botan into my Python 3.6 directories so that I can use cryptoshop.
I've also attempted to do pip install Botan, as that is how I've installed so many other python libraries but that has been unsuccessful as well.
make is a linux command
According to the botan website you can use nmake as a replacement on windows ( http://wiki.c2.com/?UsingNmake ) :
On Windows
You need to have a copy of Python installed, and have both Python and
your chosen compiler in your path. Open a command shell (or the SDK
shell), and run:
$ python configure.py --cc=msvc (or --cc=gcc for MinGW) [--cpu=CPU]
$ nmake
$ botan-test.exe
$ nmake install
Botan supports the nmake replacement Jom which enables you to run
multiple build jobs in parallel.
source : https://botan.randombit.net/manual/building.html
For completeness, here's how I made it work on a Mac
Assuming you have brew installed.
brew install botan
You may need to install other functionality first:
brew install gmp
brew install mpfr
brew install mpc
Find out where botan got installed with brew info botan.
My location is /usr/local/Cellar/botan/2.6.0
In that folder, you'll find lib/python2.7/site-packages, copy the contents of this folder into your Python's installation site-packages folder.
Note 1: At the time of this writing, only python 2.7 seems to be supported, but I'm using python 3.6 and everything seems to be working.
Note 2: If the file is called botan2.py, you may need to rename it to botan.py in your python's site-packages folder.
Related
I've succesfully installed Python version 3.8.1 and also PIP.
After that i want to install Pygame and Pygame Zero with the commands
pip install pygame
or
pip install pgzero
But I get the following error:
C:\>pip install pygame
Traceback (most recent call last):
File "c:\program files\python38\lib\runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\program files\python38\lib\runpy.py", line 86, in _run_code
exec(code, run_globals)
File "C:\Program Files\Python38\Scripts\pip.exe\__main__.py", line 9, in <module>
TypeError: 'module' object is not callable
Also with the --user command it doesn't succeed:
pip install pygame --user
or
pip install pgzero --user
What am I doing wrong here now?
I also got that problem long ago.
You can try this:
pip uninstall pygame
pip uninstall pgzrun
then download it by:
pip install pygame
pip install pgzrun
Info of your assets are little low.. But if you have Python 2 and 3, try manage your alias on CMD by checking your current python variables from /usr/bin and from CMD type "python --version" to see current default. If it says Python2.7 you can chance that with "alias" command below (reason to do that, is 2.7 support is ending 1.1.2020 and old pip for it too. So in future, you should upload new modules just for Python3.7). If you have 2.7 in your PC and you have been using it for some time, you should not try to remove it.
So just in case:
$ alias python="/usr/bin/python3.7"
Then use command
$ sudo pip3 install pygame
This should work. If not, there is some setting problems on your module site.
Give a hit with this and if it doesn't work, let us know. I can give instruction to get it to work. It requires few steps at (in my case:)
/home/usr/Python-3.7.4/Modules/Settings.
It can (I'm not sure with these modules but..) require to set SSL connection too, but it can be done from there too, without any coding.
Thank you for the quick arswers!
It is succeeded by giving the commands:
py -3 -m pip install pygame --user
py -3 -m pip install pgzero --user
The only warnings i got by installing pgzero were:
Collecting pgzero
Downloading .....
Installing collected packages: numpy, pgzero
WARNING: The script f2py.exe is installed in 'C:\Users\Han\AppData\Roaming\Python\Python38\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
WARNING: The script pgzrun.exe is installed in 'C:\Users\Han\AppData\Roaming\Python\Python38\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed numpy-1.18.0 pgzero-1.2
Oh.. I didn't know, you are using Windows.. My last answer dried down with that. It was for Linux.
Either way, when you installed python, did you mark the PATH in installation process?
It shows when installation windows pops up.
I'm little noob with windows, but I expect it to be as same as in any operation systems.
If you didn't, its easier to remove Python and install it again, than try to mark the PATH after installing. After all its just 1/2 min job.
I am unable to import the sqlite3 module in Python, version 3.5.0. Here's what I get:
>>> import sqlite3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/sqlite3/__init__.py", line 23, in <module>
from sqlite3.dbapi2 import *
File "/usr/local/lib/python3.5/sqlite3/dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: No module named '_sqlite3'
I know, I know, there are PLENTY of StackOverflow posts and support forums across the web where people complain about this problem, but none of the posted solutions have worked for me so far. Here's where I've been:
I also have Python 2.6.6 installed on this server, which is running CentOS 6.8 x86_64. I can open up the Python REPL and import sqlite3 just fine when using Python 2.6.6. I can also use sqlite3 from straight from bash and nothing seems awry.
This helpful question looked promising. I tried to re-configure and re-compile Python3.5 with the --enable-loadable-sqlite-extensions option, as user jammyWolf suggested. Nope, same error still occurs.
I've been using virtual environments like a good boy, but I have root access to this server. So, I was a bad boy and ran python3 as root without any virtualenvs activated. Still no luck. So I don't think it has anything to do with permissions.
I noticed that in the error message, it says No module named '_sqlite3'. This thread suggests that the underscore before the module name means that the module is an implementation detail, and isn't exposed in the API. ... I'm not sure what to make of this information, but there may be a hint somewhere in there.
Any ideas?
Falsetru is correct, I am going to go into a bit more detail for those not familiar (linux instructions). If you are getting this error, chances are you are using a version of python that was compiled without the correct headers. Here's a step by step guide to get it sorted. (Python 3.X.X instructions)
Install the required sqlite libraries
sudo apt-get install libsqlite3-dev
Uninstall python (I'm using python 3.6.5 as an example in this guide)
sudo apt-get remove python3.6
Download python from source
cd /tmp && wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz
Unpack the archive
tar -xvf Python-3.6.5.tgz
Configure
cd Python-3.6.5 && ./configure
Make and install (and go make coffee while you're at it)
make && sudo make install
If you did everything correctly running "python3.6 -V" should give you your python version. Note you will have to rebuild any virtual environments you have as well.
One final caveat you may encounter.
zipimport.ZipImportError: can't decompress data; zlib not available
This happens if you don't have the following zlib library installed:
sudo apt-get install zlib1g-dev
Install sqlite-devel package which includes header, library that is required to build sqlite3 extension.
yum install sqlite-devel
NOTE: Python does not include sqlite3 library itself, but an extension module (wrapper).
I copied sqlite3.dll to this folder:
C:\Users\*****\Anaconda3\DLLs
It worked after two weeks trying everything else.
I am trying to install a module on python 3.2 but am unable to. I am using Windows 7. I need to have the module installed only on Python 3.2, so solutions that work for other versions of Python won't be helpful to me (I had no problem installing modules in Python 2.7 or 3.3, 3,4) I got rid of all my other versions of python, because I thought that might be the problem.
I have tried both using pip install, and to manually install the package and neither works. At first glance it looks like I am installing setuptools and pip correctly. Here is the output I get when I try to install pip
Installed c:\python32\lib\site-packages\setuptools-7.0-py3.2.egg
Processing dependencies for setuptools==7.0
Finished processing dependencies for setuptools==7.0
PS C:\> python32 .\get-pip.py
Requirement already up-to-date: pip in c:\python32\lib\site-packages
Cleaning up...
PS C:\> pip install geopy
It looks fine, right?
Then when I try to use by entering pip install geopy Here is the output I get
pip: the termpipis not recognized as the name of a cmdlet, function or operable program etc. I made sure that python 3.2 was specified in the path environments, and uninstalled all other versions of pythons. I don't know what else I can do?
I also tried to manually install geopy. I went to the geopy page on github and pressed on "Download ZIP". I then extracted the folder to lib/site-packages directory in python32. When I tried to install using the setup.py (python32 setup.py install) Here is the error message that I got. I am not sure what this error message means
Traceback (most recent call last):
File "setup.py", line 6, in <module>
from geopy import __version__ as version
File "C:\python32\lib\site-packages\geopy-master\geopy\__init__.py", line 10, in <module>
from geopy.location import Location
File "C:\python32\lib\site-packages\geopy-master\geopy\location.py", line 21
def __init__(self, address=u"", point=None, raw=None):
Update: GeoPy 1.6.0 introduced support for Python 3.2, so update it and it should install and work.
Old answer:
This is a bug with geopy, and/or it doesn't support Python 3.2. With this Python release, strings cannot be in the form u"the string", since it is a SyntaxError. This was fixed with PEP-414 for Python 3.3.
While you can install the package, a quick fix for geopy is to edit the installed files to remove the u in several module files, such as "C:\python32\lib\site-packages\geopy-master\geopy\location.py" (as shown in your question).
For example:
Change address=u"" to address=""
Change signature_method=u"HMAC-SHA1" to signature_method="HMAC-SHA1"
Also watch out for single quote changes, e.g. u'the string'
etc.
When I compile pyQt on Windows 7 it returns an error saying:
Traceback (most recent call last):
File "configure.py", line 32, in <module>
import sipconfig
ImportError: No module named sipconfig
I have configured sip but the error still occurs. Can anyone help?
The same happened to me on OSX.
As #Janne Karila suggested, you need to download and build SIP first.
In the extracted sip source folder issue these commands in a terminal:
python configure.py
make
sudo make install
After that (in case it succeeds) you should be able to build PyQt in his folder using the same 3 commands.
When building sip, try using sudo so you can write the files to the /System directory:
sudo python configure.py
sudo make
sudo make install
I had same issue, then looked at the install directories and noticed files where not there, so I used sudo and successfully built it. Got PyQt built as well.
After downloading the sip from here download. Extract the sip folder in the PyQt4 folder
cd sip-version
python configure.py
make
make install
From the same location and it will compile and save to C:\Python folder
I'm trying to convert some date/times to UTC, which I thought would be dead simple in Python - batteries included, right? Well, it would be simple except that Python (2.6) doesn't include any tzinfo classes. No problem, a quick search turns up python-dateutil which should do exactly what I need.
The problem is that I need to install it on Windows. I was able to upack the .tar.gz2 distribution using 7-zip, but now I'm left with a collection of files and no guidance on how to proceed. When I try to run setup.py I get the error "No module named setuptools".
If dateutil is missing install it via:
pip install python-dateutil
Or on Ubuntu:
sudo apt-get install python-dateutil
Why didn't someone tell me I was being a total noob? All I had to do was copy the dateutil directory to someplace in my Python path, and it was good to go.
Looks like the setup.py uses easy_install (i.e. setuptools). Just install the setuptools package and you will be all set.
To install setuptools in Python 2.6, see the answer to this question.
Install from the "Unofficial Windows Binaries for Python Extension Packages"
http://www.lfd.uci.edu/~gohlke/pythonlibs/#python-dateutil
Pretty much has every package you would need.
It is a little tricky for people who is not used to command prompt. All you have
to do is open the directory where python is installed (C:\Python27 by default) and open the command prompt there (shift + right click and select open command window here) and then type :
python -m pip install python-dateutil
Hope that helps.
Using setup from distutils.core instead of setuptools in setup.py worked for me, too:
#from setuptools import setup
from distutils.core import setup
If you are offline and have untared the package, you can use command prompt.
Navigate to the untared folder and run:
python setup.py install
Just run command prompt as administrator and type this in.
easy_install python-dateutil
You could also change your PYTHONPATH:
$ python -c 'import dateutil'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named dateutil
$
$ PYTHONPATH="/usr/lib/python2.6/site-packages/python_dateutil-1.5-py2.6.egg":"${PYTHONPATH}"
$ export PYTHONPATH
$ python -c 'import dateutil'
$
Where /usr/lib/python2.6/site-packages/python_dateutil-1.5-py2.6.egg is the place dateutil was installed in my box (centos using sudo yum install python-dateutil15)
First confirm that you have in C:/python##/Lib/Site-packages/ a folder dateutil, perhaps you download it, you should already have pip,matplotlib, six##,,confirm you have installed dateutil by--- go to the cmd, cd /python, you should have a folder /Scripts. cd to Scripts, then type --pip install python-dateutil --
----This applies to windows 7 Ultimate 32bit, Python 3.4------
I followed several suggestions in this list without success. Finally got it installed on Windows using this method: I extracted the zip file and placed the folders under my python27 folder. In a DOS window, I navigated to the installed root folder from extracting the zip file (python-dateutil-2.6.0), then issued this command:
.\python setup.py install
Whammo-bammo it all worked.