How to start pipenv - python

I have been try to my pipenv going but it gives me this error
Creating a virtualenv for this project…
Pipfile: C:\Users\User\Pipfile
Using C:/Python/Python37/python.exe (3.7.1) to create virtualenv
[ ==] Creating virtual environment...FileNotFoundError: [Errno 2] No such file or directory
'c:\\python\\python37\\Lib\\venv\\scripts\\nt\\python.exe'
Failed creating virtual environment here
I tried to changed the file path made sure it is in same path as where python is installed still get the same problem.

copy following files from python location(C:\Program Files\Python37) to the (C:\Program Files\Python37\Lib\venv\scripts\nt)
1) python_d.exe
2) python_d.pdb
3) pythonw_d.exe
4) pythonw_d.pdb

thanks this solved the problem just one question if i want to use git clone command which filepath should i used?
because if i used the git clone command in same path
C:\Users\User>git clone https://github.com/jadhavpritish/Dream11_Predictor.git
C:\Users\User>pipenv run python src/player_selection_dream11.py
C:\Users\User\.virtualenvs\User-jBUq-HwN\Scripts\python.exe: can't open file 'src/player_selection_dream11.py': [Errno 2] No such file or directory

Okay! So what I just did to resolve it is that;
This message popped up (Shortly)
[ ==] Creating virtual environment...FileNotFoundError: [Errno 2] No such file or directory: 'c:\\users\\arham rumi\\appdata\\local\\programs\\python\\python37-32\\Lib\\venv\\scripts\\nt\\python.exe'
Then I went to the mentioned directory, and there was no such file like python.exe
Then I went back to python37-32 folder or you can simply go to the directory where you have that python.exe file. Copy this and paste it to the directory mentioned in the error.
And that's how I resolved this problem

Related

How do I set the path where gen_py is created (win32com.__gen_path__)

I'm trying to run a Python subprocess in Python. Specifically it's WinPython 3.6.1.0. I am on a company PC so Python is not installed in C:\Program Files but in a custom folder.
This is how I start it:
envs = {'SYSTEMROOT': r'C:\Windows', 'PATH': config.path_python}
subprocess.run('pip.exe install -e . --no-deps', shell=True, env=envs)
FileNotFoundError: [Errno 2] No such file or directory:
'C:\\WINDOWS\\gen_py\\3.6\\__init__.py'
My guess: It's trying to write gen_py to r'C:\Windows' where it does not have write privileges, and subsequently fails to read it. I want to fix it by deleting SYSTEMROOT but then I get
Fatal Python error: failed to get random numbers to initialize Python
From Google: 1 2. I tried setting %APPDATA% to a writable folder ('APPDATA': r'C:\Users\MyUser\AppData\Roaming') but no dice :/
I just had to add a TEMP key to my envs dict. It now looks like so:
envs = {
'SYSTEMROOT': r'C:\Windows',
'TEMP': r'C:\Users\MyUser\AppData\Local\Temp',
'PATH': config.path_python
}

No such file or directory on Mac terminal for python

hello.py is my first python program. It is saved on my desktop.
In the terminal I write in front of
user#AA-MacBook-Air ~ % python3 hello.py
The error is
can't open file 'hello.py': [Errno 2] No such file or directory
Kindly help me understand the problem and solve it.
In the terminal you are currently in the directory ~. This signifies the folder /Users/<username>. Your script is on your desktop.
Type cd Desktop to change to /Users/<username>/Desktop and then run python3 hello.py.
you first need to change destination with cd
The error message, No such file or directory pretty much gives the explanation. Check if the file hello.py is present in the correct working directory. This can done graphically or using the ls command. If it is not present, copy the file the to the directory or navigate to the location of the file hello.py in terminal using cd.

How to add whl file on pip requirements files?

Assuming you created a whl of a proprietary project and would like to reuse it in another python project, how to indicate it via a relative path in a pip file without exposing whl online?
Although there is no direct description for this problem, from the documentation (https://pip.readthedocs.io/en/1.1/requirements.html) I have tried the following:
Indicate using -e file:
./folder/my-project-0.1.0-cp36-cp36m-linux_x86_64.whl#egg=my-project==0.1.0
got> NotADirectoryError: [Errno 20] Not a directory
Indicate using file:
./folder/my-project-0.1.0-cp36-cp36m-linux_x86_64.whl#egg=my-project==0.1.0
got> FileNotFoundError: [Errno 2] No such file or directory:
'/folder/my-project-0.1.0-cp36-cp36m-linux_x86_64.whl'
It seems to seek the file on the root folder instead of the relative one.
Indicate without file:
folder/my-project-0.1.0-cp36-cp36m-linux_x86_64.whl got> Invalid
requirement: 'folder/my-project-0.1.0-cp36-cp36m-linux_x86_64.whl'
It looks like a path. Does it exist ?
It appears that if I indicate the folder instead it will work.
But as this is not the case, does anyone know how to fix it?
numpy
pandas
file:./folder/my-project-0.1.0-cp36-cp36m-linux_x86_64.whl#egg=my-project==0.1.0
Pip install whl file using relative path with success!

Why this error when I try to create workspaces in ROS?

Whenever I try to create a workspace:
~/catkin_ws$ catkin_make
It shows like this:
ImportError: "from catkin_pkg.package import parse_package" failed: No module named 'catkin_pkg'
Make sure that you have installed "catkin_pkg", it is up to date and on the PYTHONPATH.
CMake Error at /opt/ros/kinetic/share/catkin/cmake/safe_execute_process.cmake:11 (message):
execute_process(/home/usuario/miniconda3/bin/python
"/opt/ros/kinetic/share/catkin/cmake/parse_package_xml.py"
"/opt/ros/kinetic/share/catkin/cmake/../package.xml"
"/home/usuario/catkin_ws/build/catkin/catkin_generated/version/package.cmake")
returned error code 1
Call Stack (most recent call first):
/opt/ros/kinetic/share/catkin/cmake/catkin_package_xml.cmake:63 (safe_execute_process)
/opt/ros/kinetic/share/catkin/cmake/all.cmake:151 (_catkin_package_xml)
/opt/ros/kinetic/share/catkin/cmake/catkinConfig.cmake:20 (include)
CMakeLists.txt:52 (find_package)
-- Configuring incomplete, errors occurred!
See also "/home/usuario/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/home/usuario/catkin_ws/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed
It seems like there is a problem with catkin_pkg but I dont find the solution
I just installed ROS on Ubuntu 16.04, had the same issue, and fixed it. The location for catkin_pkg is likely not on your PYTHONPATH and needs to be added.
From the error output:
Make sure that you have installed "catkin_pkg", it is up to date and on the PYTHONPATH.
Try locating catkin_pkg and check your PYTHONPATH. catkin_pkg wasn't on my PYTHONPATH (likely due to other program installs), so I added it and ran catkin_make again, this time successfully.
~/catkin_ws$ locate catkin_pkg
/usr/lib/python2.7/dist-packages/catkin_pkg
~/catkin_ws$ echo $PYTHONPATH
/opt/ros/kinetic/lib/python2.7/dist-packages
To append the catkin_pkg dir to PYTHONPATH (for this session):
~/catkin_ws$ export PYTHONPATH=$PYTHONPATH:/usr/lib/python2.7/dist-packages
For permanency I appended the catkin_pkg dir to PYTHONPATH in my .bashrc (you might want to backup your .bashrc file first, e.g. cp -p ~/.bashrc ~/.bashrc-ros-catkin.bak).
To do this, edit your ~/.bashrc file (you might need to use sudo to edit this file) and add the following two lines to the end of the file:
# manually added for ROS catkin_make workspace setup
export PYTHONPATH=$PYTHONPATH:/usr/lib/python2.7/dist-packages
Save the file and run source to update your session:
~/catkin_ws$ source ~/.bashrc
Check your PYTHONPATH again:
~/catkin_ws$ echo $PYTHONPATH
/opt/ros/kinetic/lib/python2.7/dist-packages:/usr/lib/python2.7/dist-packages
Obviously the location of your catkin_pkg files might be different to mine, so use that path instead when appending to $PYTHONPATH above.
Now try running catkin_make again. If you get the same error, paste the output of your catkin_pkg location and PYTHONPATH here.
Cheers,
sb
Are you using Anaconda environment?
This issue is quite common with Anaconda's Python installation.
Try: python --version
If you see Anaconda in the output, go to your bashrc file with vi ~/.bashrc and then comment the line where anaconda is added to path.
It would be something like,
export PATH="username/anaconda2/bin:$PATH"
After that source your bashrc with source ~/.bashrc, open a new terminal and navigate to your catkin workspace. Delete the old build folder and try the catkin_make command again.
Should solve your issue.
The Error Output:
ImportError: "from catkin_pkg.package import parse_package" failed: No module named 'catkin_pkg'
Make sure that you have installed "catkin_pkg", it is up to date and on the PYTHONPATH.
As mentioned above you need have "catkin_pkg" in PYTHONPATH. The easiest way if you ask me is:
$ pip install catkin_pkg
try this : pip install -U rosdep rosinstall_generator wstool rosinstall six vcstools
if pip shows any errror, switch to root and install pip and then try
Actually when you want to use Anaconda and ROS simultaneously then generally this error comes. So firstly go in .bashrc file and comment the path of anaconda.
Export PATH="/home/gaurav/anaconda3/bin:$PATH".
After commenting go in catkin_ws folder and delete the existing folder within the folder and make new src folder.
Then follow three steps:
1 - $ mkdir src
2 - $ catkin_init_workspace src
3 - $ catkin_make
It works for me.
This means you havent sourced ROS into your environment.
Add this line to the last line of your .bashrc file
source /opt/ros/kinetic/setup.bash
Save the .bashrc file, close the current terminal and start your process in a new terminal.
for me, it fixed by
sudo apt-get remove python3-catkin-tools
sudo apt-get install python-catkin-tools

How do I install python app?

I want to install the app I found on a github page (https://github.com/googlei18n/fontview), how do I do it? I tried opening the 'build.py' file through mac terminal but it doesn't work, as well as pyton luncher- it freezes.
Kajas-MacBook-Pro:~ Kaja1$ cd fontview-master
Kajas-MacBook-Pro:fontview-master Kaja1$ cd src
Kajas-MacBook-Pro:src Kaja1$ cd fontview
Kajas-MacBook-Pro:fontview
Kaja1$ python2.7 build.py && ./build/FontView.app/Contents/MacOS/fontview
/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'build.py': [Errno 2] No such file or directory
You are in the wrong directory. Change back to the folder fontview-master and run the command from there.

Categories