Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to pip install package in anaconda on windows 10 #13

Open
Joost-A opened this issue Mar 13, 2020 · 4 comments
Open

Not able to pip install package in anaconda on windows 10 #13

Joost-A opened this issue Mar 13, 2020 · 4 comments

Comments

@Joost-A
Copy link

Joost-A commented Mar 13, 2020

I tried to install the package with the anaconda prompt on a windows 10 system using the command 'pip install ovf'. I recieved the following error message:

Collecting ovf
  Using cached ovf-0.4.3.tar.gz (492 kB)
    ERROR: Command errored out with exit status 1:
     command: 'c:\anaconda3\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-0ueof6kx\\ovf\\setup.py'"'"'; __file__='"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-0ueof6kx\\ovf\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\user\AppData\Local\Temp\pip-install-0ueof6kx\ovf\pip-egg-info'
         cwd: C:\Users\user\AppData\Local\Temp\pip-install-0ueof6kx\ovf\
    Complete output (9 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\user\AppData\Local\Temp\pip-install-0ueof6kx\ovf\setup.py", line 123, in <module>
        long_description = read(README),
      File "C:\Users\user\AppData\Local\Temp\pip-install-0ueof6kx\ovf\setup.py", line 45, in read
        with codecs.open(os.path.join(HERE, *parts), "rb", "utf-8") as f:
      File "c:\anaconda3\lib\codecs.py", line 897, in open
        file = builtins.open(filename, mode, buffering)
    FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-0ueof6kx\\ovf\\..\\README.md'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

I then tried to clone the respository with git. I gave the anaconda prompt the command: "pip install git+https://github.com/spirit-code/ovf.git" and got the following error message.

Collecting git+https://github.com/spirit-code/ovf.git
  Cloning https://github.com/spirit-code/ovf.git to c:\users\user\appdata\local\temp\pip-req-build-k2mltrb6
  Running command git clone -q https://github.com/spirit-code/ovf.git 'C:\Users\user\AppData\Local\Temp\pip-req-build-k2mltrb6'
    ERROR: Command errored out with exit status 1:
     command: 'c:\anaconda3\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-req-build-k2mltrb6\\setup.py'"'"'; __file__='"'"'C:\\Users\\user\\AppData\\Local\\Temp\\pip-req-build-k2mltrb6\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\user\AppData\Local\Temp\pip-req-build-k2mltrb6\pip-egg-info'
         cwd: C:\Users\user\AppData\Local\Temp\pip-req-build-k2mltrb6\
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "c:\anaconda3\lib\tokenize.py", line 452, in open
        buffer = _builtin_open(filename, 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\user\\AppData\\Local\\Temp\\pip-req-build-k2mltrb6\\setup.py'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Details;
-python version: 3.6
-pip version: 20.0.2
-operating system : 64 bit windows 10
-git version: 2.25.1.windows.1

@GPMueller
Copy link
Member

To be honest I don't know what is necessary to support this kind of package with conda... conda has always given me problems.
Can you try to manually build the package on your machine instead of downloading it from PyPI?

cd python
python setup.py sdist bdist_wheel;

@Joost-A
Copy link
Author

Joost-A commented Mar 17, 2020

Thank you for your quick response. If I try building it manually as you suggested I get the following error message:

C:\Users\user\ovf-master\python>python setup.py sdist bdist_wheel;
Traceback (most recent call last):
  File "setup.py", line 49, in <module>
    META_FILE = read(META_PATH)
  File "setup.py", line 45, in read
    with codecs.open(os.path.join(HERE, *parts), "rb", "utf-8") as f:
  File "C:\Users\user\AppData\Local\Programs\Python\Python37-32\lib\codecs.py", line 898, in open
    file = builtins.open(filename, mode, buffering)
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\user\\ovf-master\\python\\ovf\\__init__.py'

I looked around for the __init__.py file, but I couldn't find it so I (with my basic python knowledge) am not quite sure why it is called. Any help is appreciated.

@MSallermann
Copy link
Member

The __init__.py file is automatically generated by cmake (https://cmake.org).
Here are the steps to build from source, that worked for me:

  1. Run cmake on the source directory. You can use the cmake GUI for that. Make sure to set OVF_BUILD_PYTHON_BINDINGS=ON.
  2. CMake will generate a Visual Studio solution ovf.sln (and the __init.py__ file). Open the solution in Visual Studio and build it from there. This will create the ovf.dll file, which I copied to the ovf\python directory.
  3. Now you can perform the steps posted by gmueller.

cd python
python setup.py sdist bdist_wheel;

@GPMueller
Copy link
Member

Dear @Joost-A, were you able to resolve your issue? If so, I'd like to close this.

For reference, the Python-package build in the CI is currently:

- name: Create build folder
run: cmake -E make_directory ${{runner.workspace}}/build
- name: ⚙ Configure
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CMAKE_FLAGS
- name: 🛠 Build
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake --build . --config $BUILD_TYPE -j 2
- name: Install necessary packages
run: |
python -m pip install --upgrade pip
python -m pip install numpy setuptools wheel twine
- name: Build python package
shell: bash
working-directory: ./python
run: |
echo "Python package build"
echo "Add suffix to ovf version tag for python package $OVF_ADD_VERSION_SUFFIX"
python setup.py sdist bdist_wheel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants