Can i install Python-unicodecsv in Python 3.0? - python-3.x

Im trying to install python-unicodecsv in python 3.0 for Odoo. but it say "unable to locate package python-unicodecsv

You can just make the download in below from the git repository
https://github.com/jdunck/python-unicodecsv
Installation steps:
Step 1. Download and Extract the .zip file
download directly as zip file and extract it from the below way
Extract within the same directory :
unzip python-unicodecsv-master.zip <your .zip file name>
Extract within the another directory :
unzip python-unicodecsv-master.zip <your .zip file name> -d <direcroty path>
Step 2. Install the .zip file using terminal in Ubuntu
just go to the extracted directory path through the terminal then type the below command
sudo python setup.py install
then finally your library installed successfully and you can
access the all the library which are related to the python-unicodecsv and used it in your python file.
I hope this should helpful for you :)

Related

How can I download a folder from google drive or dropbox using command in linux?

I am trying to download a folder using command in linux shell using dropbox or google drive link. The download works but it is not saved as a folder, after it is downloaded I cannot access it using 'cd ..' command. So the folder is downloaded but when I use cd .. , I get the message that the file is not a directory.
How can I download a folder and access it? I am also executing this in virtual machine.
I do not know which method you are using to download the directory. In order to download a directory, you need to recursively download all the files in it or, create a tar or zip for the directory.
You can consider using gdown.
Please also read the detailed explanation from the following post: wget/curl large file from google drive

Teressa - Unable to Install from binary distribution

Im having difficulty installing teressa from a binary distribution. (https://docs.tessera.consensys.net/en/stable/HowTo/Get-started/Install/Distribution/) I have extracted the .tar file from the github link however the teressa/bin command only displays 1 command which is the teressa help command despite me running various different commands such as terresa version and terresa -keygen , it will still only display the teressa help command and I am unsure why that is the case
My Script:
C://Program Files/ tar xvf tessera-dist-22.1.7.tar
(To extract tar file from github repo under docs)
C://Program Files/ cd tessera-22.1.7/bin/ tessara help
(Shows help)
C://Program Files/ cd tessera-22.1.7/bin/ tessara version
(Shows help again)
Update: I managed to get the Tessera functions to work properly through running the tessera image on docker desktop.
I used docker run quorumengineering/tessera:latest on command prompt/windows powershell. And docker cp container-id:/path C://Program Files to copy and paste my private keys from docker container into my local windows file explorer

Uploaded pypi package missing module on install

I have created a python package and would like to distribute it on pypi ( https://pypi.org/project/catapi.py/ ). My initial v0.1.1 upload worked without issue. I decided to add in a sub directory to store abstract classes because there was a lot of code reuse. Upon uploading this to pypi and installing, I get the message that the abc module does not exist.
I did some research and found that I must include the subdirectory in the MANIFEST.in file, so I did. Upon uploading and attempting an install again, I get the same error. I downloaded the package directly and extracted the files to find the abc directory does indeed exist. Next I checked the site-packages version of catapi only to find it does not have the abc module.
Has anyone encountered this and know how to fix this? Here's a script to show the issue
# make a temp dir to hold this in
mkdir catapi
cd catapi
# Prepare python venv
python -m venv env-catapi
source env-catapi/bin/activate
pip install catapi.py==0.3.4
# Download file for comparison
wget https://files.pythonhosted.org/packages/ac/ee/044c1cc53e7c994fe4a7d57362651da8adff54eb34680c66f62a1d4fb57d/catapi.py-0.3.4.tar.gz
tar -xvf catapi.py-0.3.4.tar.gz
diff catapi.py-0.3.4/catapi env-catapi/lib/python3.8/site-packages/catapi
deactivate
cd ../
# Prints out
# Only in catapi: abc
# Only in env-catapi/lib/python3.8/site-packages/catapi: __pycache__
It's necessary to add in the sub-directories into the
packages=['package1', 'package2', 'etc']
part of setup.py. In my case, I had to add in the abc directory to have it placed in the catapi install
packages=['catapi', 'catapi.abc'],

Unable to import Pandas in AWS Lambda

I am new to AWS Lambda and I want to run code on Lambda for a machine learning API. The functions that I want to run on Lambda are, in summary, one to read some csv files to create a pandas dataFrame and search in it and the other to run some pickled machine learning models through requests from a Flask application. To do this, I need to import pandas, joblib and possibly scikit-learn which are compatible with Amazon Linux. I am using a Windows machine.
In general, I am going with the approach of using Lambda's layers by uploading zip files. Of course, since Lambda has a pre-built layer with SciPy and Numpy so I will not import them. If I import them, I will exceed Lambda's layer limit anyway.
To be more specific, I have done the following:
Downloaded and extracted linux-compatible versions of the libraries listed above. For example: From this link I have downloaded "pandas-0.25.0-cp35-cp35m-manylinux1_x86_64.whl" and unzipped to a folder.
The unzipped libraries are in the following directory:
lambda_layers\python\lib\python3.7\site-packages
They are zipped into a file and uploaded onto S3 Bucket for creating a layer.
I imported the packages:
import json
import boto3
import pandas as pd
I got the following error from Lambda:
{
"errorMessage": "Unable to import module 'lambda_function': C extension: No module named 'pandas._libs.tslibs.conversion' not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace --force' to build the C extensions first.",
"errorType": "Runtime.ImportModuleError"
}
Folder structure should be standard, you can also use Docker to create the zipped Linux compatible library and upload it in AWS Lambda layers. Below are the tested commands to create the zipped library for AWS Lambda layer:
Create and navigate to a directory :
$mkdir aws1
$cd aws1
Write the below commands in Dockerfile and exit by CTRL + D :
$cat> Dockerfile
FROM amazonlinux:2017.03
RUN yum -y install git \
python36 \
python36-pip \
zip \
&& yum clean all
RUN python3 -m pip install --upgrade pip \
&& python3 -m pip install boto3
You can provide any name for the image :
$docker build -t pythn1/lambda .
Run the image :
$docker run --rm -it -v ${PWD}:/var/task pythn1/lambda:latest bash
Specify the package which you want to zip, in requirements.txt and exit by CTRL + D :
$ cat > requirements.txt
pandas
sklearn
You can try using correct file structure (/python/lib/python3.6/site-packages/) here, but I did not test it yet :
$pip install -r requirements.txt -t /usr/lib/python3.6/dist-packages/
Navigate to the below directory :
$cd var/task
Create a zip file :
$ zip -r ./layers.zip /usr/lib/python3.6/dist-packages/
You should be able to see a layers.zip file in aws1 folder. If you provide the correct folder structure while installing, then the below steps are not required. But, with the folder structure I used, below commands are required :
Unzip layers.zip.
Exit Docker or open a new terminal and navigate to the folder where you unzipped the file. Unzipped file will be in the folder structure /usr/lib/python3.6/dist-packages/.
Copy these files to the correct folder structure :
$ cp -r ./python/lib/python3.6/site-packages/ /usr/lib/python3.6/dist-packages/
Zip them again :
$ zip -r ./lib_python.zip ./python
Upload the zip file to the layer, and add that layer to your Lambda function. Also, make sure that you select the right running environment while creating the layer.
Following this document - https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html#configuration-layers-path, you should zip python\lib\python3.7\site-packages\pandas (and other dependencies) folder for your python layers.
Make sure you add the layer to your function and follow the documentation for the right permissions.
I appreciate the answers that were given, just posting my own answer (that I found after a whole day looking) here for reference purpose.
I followed this guide and also this guide.
In summary, the steps to what I did are:
Connect to my Amazon EC2 instance (running on Linux) through ssh. I
wanted to deploy an application on Beanstalk so it was already up for
me anyway.
Follow the steps in the first guide to install python 3.7.
Follow the steps in the second guide to install the libraries. One of
the key notes is not to install with pip install -t since that
will lead to the libraries and the C extensions not built.
Zip the directory found in python\lib\python3.7\site-packages\ as
mentioned by the answers here (although I did follow the directory
guide in my first attempts)
Get the file from EC2 instance through
FileZilla.
Follow the Lambda layers guide and it is done.

.install Command not found while installing PopcornTime

I am trying to install Popcorntime in ubuntu 14.04 from .tar. I have extracted .tar successfully. Then according to this link I have written sudo .install while I was in my extracted folder. But I get "sudo: .install: command not found". Also there is no .install file in my extracted folder. What can I do?
I have written sudo .install while I was in my extracted folder. But I
get "sudo: .install: command not found"
The command given there isn't sudo .install; it is sudo ./install. You have missed a / in between . and install.
And, . represents current(present) directory in which you are(here /opt/popcorntime), as displayed on the terminal.
So, install is a file inside the current directory (install is a file inside the /opt/popcorntime/ directory) , which would be /opt/popcorntime here; since you have done cd /opt/popcorntime in the previous step.
I hope it resolves your query.
If the executable "install" file is not found in the extracted package then it is probably a pre-installed package. In this case there should be an executable file called Popcorn-Time, and all you have to do is type the following command ./Popcorn-Time and the application will be launched.

Resources