pyCrypto importing only "crypto", not "Crypto" (not found) - python-2.7

I'm using python 2.7 and tried installing the pyCrypto module using pip (pip install pycrypto) which downloaded and installed the 2.6 version, as it is needed for using twisted.
However, whenever I try to use it, I get an ImportError saying that the module Crypto doesn't exist - but I can import crypto normally.
I already tried uninstalling and installing it again, but still didn't work.
Is there any bug in the package downloaded using pip or is it anything else I'm doing wrong?
Thank you.

If anyone is having this same problem, the reason was that I had mistakenlly installed the package crypto before installing pycrypto. Once I removed both packages and reinstalled pycrypto everything worked.
I believe that it might be related to Windows treating crypto and Crypto folders as the same.

Related

Conda dependent packages(rdkit) will not install properly for use in web servers(importError:DLL load failed). Is there an alternative install method?

UPDATE 1: PIL and RDKIT produced import errors because the .dll files were not placed in /venv//Lib/site-packages
I removed both packages from environment and commented out their code from my project.
Next I updated the base base environment:
conda update conda #from base env
Then I upgraded pip and setuptools and reinstalled pillow:
python -m pip install pip --upgrade
pip install setuptools --upgrade
pip install pillow
I can now add my PIL content back to the project and it will work just fine on the production server, without rdkit installed.
RDKIT is only available as a conda install, it still does not install properly and breaks PIL in the process(rdkit depends on pillow). I have reinstalled from both the rdkit and conda-forge channels. Neither work.
What is the proper way to fix this problem? I feel like the hack around of moving .dll files is risky and not a good solution.
UPDATE 0: RDKIT will not load into any server
I created a basic django project similar to what you would find in the tutorial with no static files. The project successfully published to the Apache server describe below in the original post and in Windows 10 IIS. Next modified the models.py to import rdkit and both servers gave the import error and the site would not display.
Original post:
RDKIT is the only package not loading into our production server.
We successfully set up a Wampserver to run Apache and host our Django project . . .but have to comment out all the code associated with rdkit for it to work. This inhibits many required features.
There were no issues using rdkit in Django's test server.
Primary wsgi error:
from .rdBase import rdkitVersion as __version__\r, referer: http://localhost/APP/
ImportError: DLL load failed: The specified module could not be found.\r, referer: http://localhost/APP/
Relevant packages and version details:
Windows 10
Django 2.2
Python 3.7
conda 4.8.2
rdkit 2019.09.3 conda-forge
Wampserver 3.2
Apache 2.4.41
mod-wsgi 4.7.1
postgresql 10
The methods in this blog describe how we setup the production server. With one minor change, we did not alter the httpd_vhosts.conf file and only setup the standard localhost.
The error is reproducible by trying to import rdkit(or one of its methods) into any file needed to host a web application in the described environment.
We found this 2016 thread on the rdkit sourceforge and it sounds like someone else was having a similar problem on a Linux system. This is our first time setting up a server and we have not been successful at translating the recommended fix from linux to windows. There was no follow up to know if the recommendation was attempted let alone successful.
These 2012 slides lend us to believe someone was trying to overcome a similar issue in linux (slide 9)
How would a package need to be altered to allow it to load into a webserver?
Thank you, we greatly appreciate your time and assistance.

Python latest release 2.7 shows SSL error

I have downloaded & installed python latest 2.7 version (on date - 16th July). Initially i was unable to install even pip using cmd - python get-pip.py, somehow i managed to installed pip. Then i was unable to install any package using pip. It throws SSL error. Tried multiple ways to install but no go. No proxy or admin issues observed (admin confirmed the same).
Then i uninstalled & reinstalled 2.7.10 which resolved the issue. Please check the issue and resolve it.
This issue is mainly because of old unstable version, used 2.7.10 and then everything worked.

Not able to download Scipy package for Python

I initially downloaded Python, later I installed pip and when I started downloading numpy, pandas all where installed correctly but I have problem in downloading the scipy, below I have attached my screenshot of the error appeared on my cmd.
I had the same problem, solved it by installing it from the binaries that you can find here just download the .whl file and execute pip install file.whl
Install numpy+mkl before installing scipy.

Correct way to install in to virtual environment (django-import-export package)

I am deploying my site - I have it mostly set up but I notice that when I pip install some of the packages they don't seem to have installed correctly - for instance:
django-import-export Package
CORRECT WAY - Resulting directory installed locally to C:\Python34\Lib\site-packages w/ no problem:
django_import_export-0.5.1.dist-info
INCORRECT WAY? - when installed in to virtualenv - the resulting directory is
django_import_export-0.5.1-py3.4.egg-info
Another package - openpyxl did this as well
openpyxl-2.4.7-py3.4.egg-info
What - if anything - am I doing wrong?
Note that other packages installed w/ pip in to the virtualenv work just fine (psycopg2 for instance)
Thank you in advance...
did you activated the virtualenv and then tried installing using pip?
and what i see it is correct. the info files stays like that, but the python files goes to site packages.
by d way are those packages working or not?

How to install difflib module in python 2.7 windows 10

Currently, I am facing difficulty installing difflib module in python 2.7 version in windows 10 system.
I want it to perform some text analytics analysis
tried using
apt-get install npm
npm install difflib
and
pip.exe install difflib
Solution for me was to save the difflib.py in the location where your .py file resides and then import it in your file.
install using pip should be a great idea, You can refer to the module related details here:
https://docs.python.org/2.7/library/difflib.html
If you face an issue installing it using pip, then the next way is to get the difflib.py from any working machine and keep it in the project directory itself, so that just importing the module itself will work.
This is the codebase reference from svn of python itself:
https://svn.python.org/projects/python/trunk/Lib/difflib.py