Python: Install Dependencies into directory - python

I have a Python project that I want to get worked in Amazon aws Lambda. So i need to creat a deployment package. I tried it like explained on this page:
http://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html
But here my problem:
Some Dependencies I can install, some are not installable.
If I want to install requests into a directory, It installs. If I want to install json into a directory I get the following error massage: Directory '/Users/iTom/Desktop/project-dir' is not installable. File 'setup.py' not found.
Dont know if this is important: I tried also to install json in general an got this error: Could not find a version that satisfies the requirement json (from versions: )
No matching distribution found for json
Thanks for help :)
EDIT: I got told json already included. What is with codecs and urllib?

json is a built-in package already shipped with python, you need not install it. Please see the python reference https://docs.python.org/2/library/json.html

Related

AttributeError: module 'syft' has no attribute 'TorchHook'

Please seeking help from expert: When I am using pysyft library in python I am getting this error (
AttributeError: module 'syft' has no attribute 'TorchHook')
Here is my code screenshot
[1]: https://i.stack.imgur.com/rPxWw.png
my environment :
Spyder (Python IDE)
Ubuntu 20.04
python3
The version of syft you are using is v0.3.0+. It does not contain syft.TorchHook as I believe I read that it is not needed there.
Use pip install syft==0.2.9 to use syft.TorchHook(). Especially if you are following that Secure and Private Course from Andrew Trask, Openmined.
Note that if you are indeed following that course, a new updated course has been introduced by the Openmined team. See https://courses.openmined.org/courses/foundations-of-private-computation for more details. It is based on an updated version of syft.
I would like to add one additional issue: if you found the following problem when using PIP install syft==0.2.9
Could not find a version that satisfies the requirement torch~=1.4.0 (from syft) (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2)
You can refer to the following methods to solve:
pip install syft -f https://download.pytorch.org/whl/torch_stable.html
Reason:
Not all PyTorch versions are available on Python's package registry PyPI.
-f : adding the custom registry
-f, --find-links <url>
If a URL or path to an html file, then parse for links to archives such as sdist (.tar.gz) or wheel (.whl) files. If a local path or file:// URL that’s a directory, then look for archives in the directory listing. Links to VCS project URLs are not supported.
refer to this link

Receiving "fatal error C1083: Cannot open include file: 'libxml/xpath.h': No such file or directory" while trying to install lxml

I am attempting to install lxml using "pip install lxml" in my terminal, and receiving the C1083 error. I have seen similar posts, and based on those suggested answers attempted the following:
Downloading .whl files from https://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml. I am using a 32-bit version of Python 3.8 using Windows 10 and attempt:
pip install C:\folders\lxml-4.5.2-cp38-cp38-win32.whl
however it claims it is not a supported wheel on this platform. As a check, I used every lxml from the site, with the exact same error. I then attempt to use
pip install lxml --extra-index-url=https://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml
which results in the C1083 error as well.
I am aware that I need libxml/xpath.h, but for some reason none of the wheel files are being accepted. Please let me know if there's any additional information I can provide. How can I go about installing lxml?

How to install a predefined package(class) in google colab(python,Jupyter notebook)?

I have already defined a class which I want to use in my code.
in order to import it I know I have to install it first.(I am using google's colab)
to install first I uploaded the .py file into my drive which is mounted and no problem with that.
but still there is problem with installing the package.
how can I use this predefined class correctly in my code?
!pip install robotdef.py
Collecting robotdef.py
ERROR: Could not find a version that satisfies the requirement robotdef.py (from versions: none)
ERROR: No matching distribution found for robotdef.py
I think I overlooked one thing.
If "I uploaded the .py file into my drive which is mounted and no problem with that." is the situation, you don't have to run pip, but you'll need to expand the Python path to the directory where your package(class) is installed.
I hope this may help.
import sys
sys.path.append('/foo/bar/your-modules-path')
pip fetches a package from the Python Package Index (PyPI) repository. This means that the package must be registered on the repository first.
I tried to find 'robotdef.py' or 'robotdef' using a search form on the PyPI website, but it seems that 'robotdef.py' hasn't been registered yet...
If it's on the repository, !pip install <package name> will work fine on the Colab.
Supplement
Sorry, my answer was incomplete.
It's not necessary a package to be registered on the PyPI repository, but you can install a package from local archives, etc.

"No module named 'docx'" error but "requirement already satisfied" when I try to install

From what I've read, it sounds like the issue might be that the module isn't in the same directory as my script. Is that the case? If so, how do I find the module and move it to the correct location?
Edit
In case it's relevant - I installed docx using easy_install, not pip.
I use pycharm, created a project, you can choose which interpreter you want to use tu run your program, a common problem is having 2 interpreters and installing docx in one, and launching with the other interpreter. Also check the Lib included the packages of docx.
Library
pip show docx
This will show you where it is installed. However, if you're using python3 then
pip install python-docx
might be the one you need.
Please install python-docx.
Then you import docx (not python-docx)

Pip module installation issue

I'm having difficulty installing modules using pip for python. The exact error message is:
Could not find a version that satisfies the requirement shapefile (from versions: DistributionNotFound: No matching distribution found for shapefile
When I type:
pip install -vvv shapefile
I get a 404 status code saying:
Could not fetch URL https://pypi.python.org/simple/shapefile/: 404 Client Error
I've browsed around and have seen there is a config file that allows you to change where pip installs modules from. However, I can't find this file in my /.pip folder.
Does anyone know how I would go about fixing my pip configuration so that I can install packages?
Here is a list that matches your module name: PyPI search result for shapefile
Maybe the module is called pyshapefile not just shapefile.
pip install pyshapefile

Categories

Resources